From bb415208803e0fbde0a9863edb6eb7220ca7503e Mon Sep 17 00:00:00 2001 From: asarfaty Date: Thu, 21 Nov 2019 10:16:38 +0200 Subject: [PATCH] NSX|P: verify segment realization before creating MP md proxy Change-Id: Ie85be9ece59394a55cde48c4d3a9c9d1e6191924 --- vmware_nsx/plugins/nsx_p/plugin.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/vmware_nsx/plugins/nsx_p/plugin.py b/vmware_nsx/plugins/nsx_p/plugin.py index d28e05a68a..00499f6a9a 100644 --- a/vmware_nsx/plugins/nsx_p/plugin.py +++ b/vmware_nsx/plugins/nsx_p/plugin.py @@ -765,10 +765,17 @@ class NsxPolicyPlugin(nsx_plugin_common.NsxPluginV3Base): # MD Proxy is currently supported by the passthrough api only if (is_backend_network and not az.use_policy_md and cfg.CONF.nsx_p.allow_passthrough): + + # The new segment was not realized yet. Waiting for a bit. + time.sleep(cfg.CONF.nsx_p.realization_wait_sec) + nsx_net_id = self._get_network_nsx_id(context, net_id) + if not nsx_net_id: + msg = ("Unable to obtain backend network id for metadata " + "proxy creation for network %s" % net_id) + LOG.error(msg) + raise nsx_exc.NsxPluginException(err_msg=msg) + try: - # The new segment was not realized yet. Waiting for a bit. - time.sleep(cfg.CONF.nsx_p.realization_wait_sec) - nsx_net_id = self._get_network_nsx_id(context, net_id) self._create_net_mp_mdproxy_port( context, created_net, az, nsx_net_id) except Exception as e: