Merge "NSX|P: Wait with segment realization until it is fully done"

This commit is contained in:
Zuul 2020-10-16 06:32:21 +00:00 committed by Gerrit Code Review
commit be7d4e192d
2 changed files with 7 additions and 0 deletions

View File

@ -1618,6 +1618,10 @@ class NsxPolicyPlugin(nsx_plugin_common.NsxPluginV3Base):
try:
nsx_id = self.nsxpolicy.segment.get_realized_logical_switch_id(
segment_id)
# Make sure the LS is already active before letting nova use it
if utils.is_nsx_version_3_1_0(self._nsx_version):
self.nsxpolicy.segment.wait_until_state_successful(
segment_id, with_refresh=True)
# Add result to caches
NET_NEUTRON_2_NSX_ID_CACHE[network_id] = nsx_id
NET_NSX_2_NEUTRON_ID_CACHE[nsx_id] = network_id

View File

@ -126,6 +126,9 @@ class NsxPPluginTestCaseMixin(
"NsxPolicySegmentApi.get_realized_logical_switch_id",
return_value=LOGICAL_SWITCH_ID
).start()
mock.patch("vmware_nsxlib.v3.policy.core_resources."
"NsxPolicySegmentApi.wait_until_state_successful"
).start()
mock.patch("vmware_nsxlib.v3.policy.core_resources."
"NsxPolicySegmentApi.get_realized_id",
return_value=LOGICAL_SWITCH_ID