Merge "Check port existence before updating it in NB DB"

This commit is contained in:
Jenkins 2016-10-05 07:37:51 +00:00 committed by Gerrit Code Review
commit 25a61b07ae
1 changed files with 6 additions and 0 deletions

View File

@ -554,6 +554,12 @@ class DFMechDriver(driver_api.MechanismDriver):
@lock_db.wrap_db_lock(lock_db.RESOURCE_ML2_CORE)
def update_port_postcommit(self, context):
updated_port = context.current
if not self.nb_api.get_logical_port(updated_port['id'],
updated_port['tenant_id']):
# REVISIT(xiaohhui): Should we unify the check before update nb db?
LOG.debug("The port %s has been deleted from dragonflow NB DB, "
"by concurrent operation.", updated_port['id'])
return
# If a subnet enabled dhcp, the DFMechDriver will create a dhcp server
# port. When delete this subnet, the port should be deleted.