'elapsed': elapsed})
self.iter_num = self.iter_num + 1
+ def get_port_stats(self, port_info, ancillary_port_info):
+ port_stats = {
+ 'regular': {
+ 'added': len(port_info.get('added', [])),
+ 'updated': len(port_info.get('updated', [])),
+ 'removed': len(port_info.get('removed', []))}}
+ if self.ancillary_brs:
+ port_stats['ancillary'] = {
+ 'added': len(ancillary_port_info.get('added', [])),
+ 'removed': len(ancillary_port_info.get('removed', []))}
+ return port_stats
+
def rpc_loop(self, polling_manager=None):
if not polling_manager:
polling_manager = polling.get_polling_manager(
ovs_restarted = False
while self._check_and_handle_signal():
start = time.time()
- port_stats = {'regular': {'added': 0,
- 'updated': 0,
- 'removed': 0},
- 'ancillary': {'added': 0,
- 'removed': 0}}
LOG.debug("Agent rpc_loop - iteration:%d started",
self.iter_num)
if sync:
# Agent doesn't apply any operations when ovs is dead, to
# prevent unexpected failure or crash. Sleep and continue
# loop in which ovs status will be checked periodically.
+ port_stats = self.get_port_stats({}, {})
self.loop_count_and_wait(start, port_stats)
continue
# Notify the plugin of tunnel IP
"ports processed. Elapsed:%(elapsed).3f",
{'iter_num': self.iter_num,
'elapsed': time.time() - start})
- port_stats['regular']['added'] = (
- len(port_info.get('added', [])))
- port_stats['regular']['updated'] = (
- len(port_info.get('updated', [])))
- port_stats['regular']['removed'] = (
- len(port_info.get('removed', [])))
+
ports = port_info['current']
if self.ancillary_brs:
{'iter_num': self.iter_num,
'elapsed': time.time() - start})
ancillary_ports = ancillary_port_info['current']
- port_stats['ancillary']['added'] = (
- len(ancillary_port_info.get('added', [])))
- port_stats['ancillary']['removed'] = (
- len(ancillary_port_info.get('removed', [])))
polling_manager.polling_completed()
# Keep this flag in the last line of "try" block,
# Put the ports back in self.updated_port
self.updated_ports |= updated_ports_copy
sync = True
-
+ ancillary_port_info = (ancillary_port_info if self.ancillary_brs
+ else {})
+ port_stats = self.get_port_stats(port_info, ancillary_port_info)
self.loop_count_and_wait(start, port_stats)
def daemon_loop(self):