Handle router HA port concurrently deleting
Router HA port may be deleted concurrently while the plugin is trying to update. This patch catches the known exceptions. Should not `plugin.update_port_statuses` use because: 1. plugin.update_port_statuses will hide all exception no matter the port exists. 2. The code just needs to catch the port not found error, but let all other exception raised if port still exists. Closes-Bug: #1906375 Change-Id: Id5d9c99be3bd6854568d2b1baa86c25c0cfd4756
This commit is contained in:
parent
5529b2f5cc
commit
91eb3d8346
@ -25,6 +25,7 @@ from neutron_lib.plugins import directory
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
import oslo_messaging
|
||||
from sqlalchemy import orm
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
@ -89,8 +90,13 @@ class L3RpcCallback(object):
|
||||
"setting HA network ports %(ha_ports)s status to DOWN.",
|
||||
{"host": host, "ha_ports": ha_ports})
|
||||
for p in ha_ports:
|
||||
try:
|
||||
self.plugin.update_port(
|
||||
context, p, {'port': {'status': constants.PORT_STATUS_DOWN}})
|
||||
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):
|
||||
"""Returns IDs of routers scheduled to l3 agent on <host>
|
||||
|
Loading…
Reference in New Issue
Block a user