From 84a09a82fce28122138db67e6418879a604ad003 Mon Sep 17 00:00:00 2001 From: Adit Sarfaty Date: Mon, 9 Sep 2019 09:48:51 +0300 Subject: [PATCH] NSX|V3+P: Fix mdproxy handling for vlan transparent Commit I24aed399a478e2d391ab7b45fe38e53b77116abb missed some fields needed for the mdproxy skipping for vlan transparent networks. This commit changes the order of initialization of a new network to overcome this issue. Change-Id: I44699f033e529473b9c19d59962042f4a586c689 --- vmware_nsx/plugins/nsx_p/plugin.py | 10 +++++----- vmware_nsx/plugins/nsx_v3/plugin.py | 11 ++++++----- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/vmware_nsx/plugins/nsx_p/plugin.py b/vmware_nsx/plugins/nsx_p/plugin.py index b8bb543287..46b4779d86 100644 --- a/vmware_nsx/plugins/nsx_p/plugin.py +++ b/vmware_nsx/plugins/nsx_p/plugin.py @@ -743,6 +743,11 @@ class NsxPolicyPlugin(nsx_plugin_common.NsxPluginV3Base): super(NsxPolicyPlugin, self).delete_network( context, net_id) + # this extra lookup is necessary to get the + # latest db model for the extension functions + net_model = self._get_network(context, net_id) + resource_extend.apply_funcs('networks', created_net, net_model) + # MD Proxy is currently supported by the passthrough api only if is_backend_network and cfg.CONF.nsx_p.allow_passthrough: try: @@ -755,11 +760,6 @@ class NsxPolicyPlugin(nsx_plugin_common.NsxPluginV3Base): LOG.error("Failed to create mdproxy port for network %s: %s", net_id, e) - # this extra lookup is necessary to get the - # latest db model for the extension functions - net_model = self._get_network(context, net_id) - resource_extend.apply_funcs('networks', created_net, net_model) - # Update the QoS policy (will affect only future compute ports) qos_com_utils.set_qos_policy_on_new_net( context, net_data, created_net) diff --git a/vmware_nsx/plugins/nsx_v3/plugin.py b/vmware_nsx/plugins/nsx_v3/plugin.py index 27d8205e26..14bd309133 100644 --- a/vmware_nsx/plugins/nsx_v3/plugin.py +++ b/vmware_nsx/plugins/nsx_v3/plugin.py @@ -970,6 +970,12 @@ class NsxV3Plugin(nsx_plugin_common.NsxPluginV3Base, {'network': {'vlan_transparent': vlt}}) rollback_network = True + + # this extra lookup is necessary to get the + # latest db model for the extension functions + net_model = self._get_network(context, created_net['id']) + resource_extend.apply_funcs('networks', created_net, net_model) + if is_backend_network: self._create_net_mdproxy_port( context, created_net, az, nsx_net_id) @@ -990,11 +996,6 @@ class NsxV3Plugin(nsx_plugin_common.NsxPluginV3Base, super(NsxV3Plugin, self).delete_network( context, created_net['id']) - # this extra lookup is necessary to get the - # latest db model for the extension functions - net_model = self._get_network(context, created_net['id']) - resource_extend.apply_funcs('networks', created_net, net_model) - # Update the QoS policy (will affect only future compute ports) qos_com_utils.set_qos_policy_on_new_net( context, net_data, created_net)