def rpc_loop(self, polling_manager=None):
     if not polling_manager:
         polling_manager = polling.get_polling_manager(
             minimize_polling=False)
     while self.run_daemon_loop:
         start = time.time()
         port_stats = {'regular': {'added': 0,
                                   'updated': 0,
                                   'removed': 0}}
         if self.fullsync:
             LOG.info(_LI("Agent out of sync with plugin!"))
             connected_ports = self._get_dvs_ports()
             self.added_ports = connected_ports - self.known_ports
             if cfg.CONF.DVS.clean_on_restart:
                 self._clean_up_vsphere_extra_resources(connected_ports)
             self.fullsync = False
             polling_manager.force_polling()
         if self._agent_has_updates(polling_manager):
             LOG.debug("Agent rpc_loop - update")
             self.process_ports()
             port_stats['regular']['added'] = len(self.added_ports)
             port_stats['regular']['updated'] = len(self.updated_ports)
             port_stats['regular']['removed'] = len(self.deleted_ports)
             polling_manager.polling_completed()
         self.loop_count_and_wait(start)
Exemplo n.º 2
0
 def rpc_loop(self, polling_manager=None):
     if not polling_manager:
         polling_manager = polling.get_polling_manager(
             minimize_polling=False)
     while self.run_daemon_loop:
         start = time.time()
         port_stats = {'regular': {'added': 0,
                                   'updated': 0,
                                   'removed': 0}}
         if self.fullsync:
             LOG.info(_LI("Agent out of sync with plugin!"))
             connected_ports = self._get_dvs_ports()
             self.added_ports = connected_ports - self.known_ports
             if cfg.CONF.DVS.clean_on_restart:
                 self._clean_up_vsphere_extra_resources(connected_ports)
             self.fullsync = False
             polling_manager.force_polling()
         if self._agent_has_updates(polling_manager):
             LOG.debug("Agent rpc_loop - update")
             self.process_ports()
             port_stats['regular']['added'] = len(self.added_ports)
             port_stats['regular']['updated'] = len(self.updated_ports)
             port_stats['regular']['removed'] = len(self.deleted_ports)
             polling_manager.polling_completed()
         self.loop_count_and_wait(start)
Exemplo n.º 3
0
 def test_manage_polling_minimizer(self):
     mock_target = 'neutron.agent.common.polling.InterfacePollingMinimizer'
     with mock.patch('%s.start' % mock_target) as mock_start:
         with mock.patch('%s.stop' % mock_target) as mock_stop:
             with polling.get_polling_manager(minimize_polling=True) as pm:
                 self.assertEqual(pm.__class__,
                                  polling.InterfacePollingMinimizer)
             mock_stop.assert_has_calls([mock.call()])
         mock_start.assert_has_calls([mock.call()])
Exemplo n.º 4
0
 def test_manage_polling_minimizer(self):
     mock_target = 'neutron.agent.common.polling.InterfacePollingMinimizer'
     with mock.patch('%s.start' % mock_target) as mock_start:
         with mock.patch('%s.stop' % mock_target) as mock_stop:
             with polling.get_polling_manager(minimize_polling=True) as pm:
                 self.assertEqual(pm.__class__,
                                  polling.InterfacePollingMinimizer)
             mock_stop.assert_has_calls([mock.call()])
         mock_start.assert_has_calls([mock.call()])
Exemplo n.º 5
0
 def daemon_loop(self):
     with polling.get_polling_manager(
             self.minimize_polling,
             self.ovsdb_monitor_respawn_interval) as pm:
         self.rpc_loop(polling_manager=pm)
Exemplo n.º 6
0
 def test_return_always_poll_by_default(self):
     with polling.get_polling_manager() as pm:
         self.assertEqual(pm.__class__, base_polling.AlwaysPoll)
Exemplo n.º 7
0
 def daemon_loop(self):
     with polling.get_polling_manager() as pm:
         self.rpc_loop(polling_manager=pm)
Exemplo n.º 8
0
 def daemon_loop(self):
     with polling.get_polling_manager() as pm:
         self.rpc_loop(polling_manager=pm)
Exemplo n.º 9
0
 def test_return_always_poll_by_default(self):
     with polling.get_polling_manager() as pm:
         self.assertEqual(pm.__class__, base_polling.AlwaysPoll)