[NSX-P] Don't cache empty logical switch id for segment
If a NSX-T segment is not realized, the plugin will currently return a null value for the corresponding logical switch id. This leads nova to boot VMs with an incorrect network attachment. This change ensures the null value is not cached for the neutron network. Change-Id: I7ef3fc8e13777e5fcdc53bd84d5dc235f7e8686c
This commit is contained in:
parent
841fa95a58
commit
d055dec0fa
@ -1724,12 +1724,14 @@ class NsxPolicyPlugin(nsx_plugin_common.NsxPluginV3Base):
|
||||
try:
|
||||
nsx_id = self.nsxpolicy.segment.get_realized_logical_switch_id(
|
||||
segment_id)
|
||||
# Add result to caches
|
||||
NET_NEUTRON_2_NSX_ID_CACHE[network_id] = nsx_id
|
||||
NET_NSX_2_NEUTRON_ID_CACHE[nsx_id] = network_id
|
||||
# Add result to caches - never cache an empty nsx_id
|
||||
if nsx_id:
|
||||
NET_NEUTRON_2_NSX_ID_CACHE[network_id] = nsx_id
|
||||
NET_NSX_2_NEUTRON_ID_CACHE[nsx_id] = network_id
|
||||
return nsx_id
|
||||
except nsx_lib_exc.ManagerError:
|
||||
LOG.error("Network %s was not realized", network_id)
|
||||
LOG.error("Network %s was not realized. Cannot fetch "
|
||||
"logical switch for segment", network_id)
|
||||
# Do not cache this result
|
||||
else:
|
||||
# Add empty result to cache
|
||||
|
Loading…
x
Reference in New Issue
Block a user