Merge "Ensure driver error preventing trunk port deletion is logged"

This commit is contained in:
Zuul 2020-01-26 12:16:17 +00:00 committed by Gerrit Code Review
commit 14dd3e95ca

View File

@ -28,6 +28,7 @@ from neutron_lib.plugins import directory
from neutron_lib.services import base as service_base from neutron_lib.services import base as service_base
from neutron_lib.services.trunk import constants from neutron_lib.services.trunk import constants
from oslo_log import log as logging from oslo_log import log as logging
from oslo_utils import excutils
from oslo_utils import uuidutils from oslo_utils import uuidutils
from neutron.db import db_base_plugin_common from neutron.db import db_base_plugin_common
@ -270,12 +271,21 @@ class TrunkPlugin(service_base.ServicePluginBase):
# object disappears from the datastore, therefore there is no # object disappears from the datastore, therefore there is no
# status transition involved. If PRECOMMIT failures occur, # status transition involved. If PRECOMMIT failures occur,
# the trunk remains in the status where it was. # the trunk remains in the status where it was.
try:
trunk.delete() trunk.delete()
except Exception as e:
with excutils.save_and_reraise_exception():
LOG.warning('Trunk driver raised exception when '
'deleting trunk port %s: %s', trunk_id,
str(e))
payload = callbacks.TrunkPayload(context, trunk_id, payload = callbacks.TrunkPayload(context, trunk_id,
original_trunk=trunk) original_trunk=trunk)
registry.notify(resources.TRUNK, events.PRECOMMIT_DELETE, self, registry.notify(resources.TRUNK,
payload=payload) events.PRECOMMIT_DELETE,
self, payload=payload)
else: else:
LOG.info('Trunk driver does not consider trunk %s '
'untrunkable', trunk_id)
raise trunk_exc.TrunkInUse(trunk_id=trunk_id) raise trunk_exc.TrunkInUse(trunk_id=trunk_id)
registry.notify(resources.TRUNK, events.AFTER_DELETE, self, registry.notify(resources.TRUNK, events.AFTER_DELETE, self,
payload=payload) payload=payload)