Merge "Handle router HA port concurrently deleting"

This commit is contained in:
Zuul 2020-12-16 16:38:41 +00:00 committed by Gerrit Code Review
commit 0a852dab99

View File

@ -25,6 +25,7 @@ from neutron_lib.plugins import directory
from oslo_config import cfg from oslo_config import cfg
from oslo_log import log as logging from oslo_log import log as logging
import oslo_messaging import oslo_messaging
from sqlalchemy import orm
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@ -89,8 +90,13 @@ class L3RpcCallback(object):
"setting HA network ports %(ha_ports)s status to DOWN.", "setting HA network ports %(ha_ports)s status to DOWN.",
{"host": host, "ha_ports": ha_ports}) {"host": host, "ha_ports": ha_ports})
for p in ha_ports: for p in ha_ports:
self.plugin.update_port( try:
context, p, {'port': {'status': constants.PORT_STATUS_DOWN}}) self.plugin.update_port(
context, p,
{'port': {'status': constants.PORT_STATUS_DOWN}})
except (orm.exc.StaleDataError, orm.exc.ObjectDeletedError,
exceptions.PortNotFound):
pass
def get_router_ids(self, context, host): def get_router_ids(self, context, host):
"""Returns IDs of routers scheduled to l3 agent on <host> """Returns IDs of routers scheduled to l3 agent on <host>