]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Don't raise if polling manager is running when stopped
authorrossella <rsblendido@suse.com>
Mon, 14 Dec 2015 12:31:17 +0000 (12:31 +0000)
committerrossella <rsblendido@suse.com>
Mon, 21 Dec 2015 15:51:48 +0000 (15:51 +0000)
AsyncProcess.stop() will raise if the process we are trying
to stop is not running. Some functional tests sporadically
fail because in the clean up the polling manager is stopped
without checking if it's still running. Add an except
in InterfacePollingMinimizer.stop() to avoid raising an
exception when the monitor is not running.

Change-Id: Iec8f5039ae5b830836564a1a402ad3e4ba38935d
Closes-bug: #1525856

neutron/agent/linux/polling.py
neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py

index be693d8c4f610d7a75ae6af2da9be77a2a7a103b..29d5bd668ee4e0673384356c62168b92aefa1217 100644 (file)
 import contextlib
 
 import eventlet
+from oslo_log import log as logging
 
 from neutron.agent.common import base_polling
+from neutron.agent.linux import async_process
 from neutron.agent.linux import ovsdb_monitor
 from neutron.plugins.ml2.drivers.openvswitch.agent.common import constants
 
+LOG = logging.getLogger(__name__)
+
 
 @contextlib.contextmanager
 def get_polling_manager(minimize_polling=False,
@@ -53,7 +57,10 @@ class InterfacePollingMinimizer(base_polling.BasePollingManager):
         self._monitor.start()
 
     def stop(self):
-        self._monitor.stop()
+        try:
+            self._monitor.stop()
+        except async_process.AsyncProcessException:
+            LOG.debug("InterfacePollingMinimizer was not running when stopped")
 
     def _is_polling_required(self):
         # Maximize the chances of update detection having a chance to
index 414039e932d44e072d5e2f1b8dbde97575ea818f..6e8859730de53924802376509fb01cd195c6058f 100644 (file)
@@ -33,7 +33,6 @@ from neutron.agent.common import ovs_lib
 from neutron.agent.common import polling
 from neutron.agent.common import utils
 from neutron.agent.l2.extensions import manager as ext_manager
-from neutron.agent.linux import async_process
 from neutron.agent.linux import ip_lib
 from neutron.agent.linux import polling as linux_polling
 from neutron.agent import rpc as agent_rpc
@@ -1812,12 +1811,7 @@ class OVSNeutronAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin,
                 # no action and by InterfacePollingMinimizer as start/stop
                 if isinstance(
                     polling_manager, linux_polling.InterfacePollingMinimizer):
-                    # There's a possible race here, when ovsdb-server is
-                    # restarted ovsdb monitor will also be restarted
-                    try:
-                        polling_manager.stop()
-                    except async_process.AsyncProcessException:
-                        LOG.debug("OVSDB monitor was not running")
+                    polling_manager.stop()
                     polling_manager.start()
             elif ovs_status == constants.OVS_DEAD:
                 # Agent doesn't apply any operations when ovs is dead, to