Merge "NSX|V3: be more robust under port name update"

This commit is contained in:
Jenkins 2016-08-30 19:16:40 +00:00 committed by Gerrit Code Review
commit 1d07f7b63a

View File

@ -2346,12 +2346,19 @@ class NsxV3Plugin(agentschedulers_db.AZDhcpAgentSchedulerDbMixin,
'device_owner': const.ROUTER_INTERFACE_OWNERS}
ports = self.get_ports(context, filters=filters)
for port in ports:
nsx_s_id_, nsx_port_id = nsx_db.get_nsx_switch_and_port_id(
nsx_s_id, nsx_port_id = nsx_db.get_nsx_switch_and_port_id(
context.session, port['id'])
if nsx_port_id:
name = utils.get_name_and_uuid(
router_name, port['id'], tag='port')
self._port_client.update(nsx_port_id, None, name=name)
try:
self._port_client.update(nsx_port_id, None,
name=name)
except Exception as e:
LOG.error(_LE("Unable to update port %(port_id)s. "
"Reason: %(e)s"),
{'port_id': nsx_port_id,
'e': e})
return self._update_router_wrapper(context, router_id, router)
except nsx_lib_exc.ResourceNotFound:
with context.session.begin(subtransactions=True):