Merge "Don't raise if polling manager is running when stopped"

This commit is contained in:
Jenkins 2015-12-22 21:00:23 +00:00 committed by Gerrit Code Review
commit b600129553
2 changed files with 9 additions and 8 deletions

View File

@ -15,11 +15,15 @@
import contextlib import contextlib
import eventlet import eventlet
from oslo_log import log as logging
from neutron.agent.common import base_polling from neutron.agent.common import base_polling
from neutron.agent.linux import async_process
from neutron.agent.linux import ovsdb_monitor from neutron.agent.linux import ovsdb_monitor
from neutron.plugins.ml2.drivers.openvswitch.agent.common import constants from neutron.plugins.ml2.drivers.openvswitch.agent.common import constants
LOG = logging.getLogger(__name__)
@contextlib.contextmanager @contextlib.contextmanager
def get_polling_manager(minimize_polling=False, def get_polling_manager(minimize_polling=False,
@ -53,7 +57,10 @@ class InterfacePollingMinimizer(base_polling.BasePollingManager):
self._monitor.start() self._monitor.start()
def stop(self): 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): def _is_polling_required(self):
# Maximize the chances of update detection having a chance to # Maximize the chances of update detection having a chance to

View File

@ -33,7 +33,6 @@ from neutron.agent.common import ovs_lib
from neutron.agent.common import polling from neutron.agent.common import polling
from neutron.agent.common import utils from neutron.agent.common import utils
from neutron.agent.l2.extensions import manager as ext_manager 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 ip_lib
from neutron.agent.linux import polling as linux_polling from neutron.agent.linux import polling as linux_polling
from neutron.agent import rpc as agent_rpc 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 # no action and by InterfacePollingMinimizer as start/stop
if isinstance( if isinstance(
polling_manager, linux_polling.InterfacePollingMinimizer): polling_manager, linux_polling.InterfacePollingMinimizer):
# There's a possible race here, when ovsdb-server is polling_manager.stop()
# restarted ovsdb monitor will also be restarted
try:
polling_manager.stop()
except async_process.AsyncProcessException:
LOG.debug("OVSDB monitor was not running")
polling_manager.start() polling_manager.start()
elif ovs_status == constants.OVS_DEAD: elif ovs_status == constants.OVS_DEAD:
# Agent doesn't apply any operations when ovs is dead, to # Agent doesn't apply any operations when ovs is dead, to