NSX|V3: remove redundent DB calls for floatingips

When extending port dict, there is no need to get the nsx LS ID from
the DB for floatingips since they belong to an external network.

Change-Id: Iea423fd467b1020416e3219e3cf34fc5144dde10
This commit is contained in:
Adit Sarfaty 2018-09-27 12:31:14 +03:00
parent 2dea64def5
commit 45ca00ea62
1 changed files with 6 additions and 2 deletions

View File

@ -628,8 +628,12 @@ class NsxV3Plugin(agentschedulers_db.AZDhcpAgentSchedulerDbMixin,
if pbin.VIF_DETAILS not in port_data:
port_data[pbin.VIF_DETAILS] = {}
port_data[pbin.VIF_DETAILS][pbin.OVS_HYBRID_PLUG] = False
port_data[pbin.VIF_DETAILS]['nsx-logical-switch-id'] = (
self._get_network_nsx_id(context, net_id))
if port_data.get('device_owner') == const.DEVICE_OWNER_FLOATINGIP:
# floatingip belongs to an external net without nsx-id
port_data[pbin.VIF_DETAILS]['nsx-logical-switch-id'] = None
else:
port_data[pbin.VIF_DETAILS]['nsx-logical-switch-id'] = (
self._get_network_nsx_id(context, net_id))
if port_data[pbin.VNIC_TYPE] != pbin.VNIC_NORMAL:
port_data[pbin.VIF_DETAILS]['segmentation-id'] = (
self._get_network_segmentation_id(context, net_id))