NSX|V3+P: Create default SG outside the port create context

Change-Id: I6e32a0bb1a592e681b124a38ca59771f719af398
This commit is contained in:
asarfaty 2021-03-03 13:46:44 +02:00 committed by Adit Sarfaty
parent 342b097ddb
commit aacf634faa
2 changed files with 10 additions and 0 deletions

View File

@ -2101,6 +2101,11 @@ class NsxPolicyPlugin(nsx_plugin_common.NsxPluginV3Base):
if is_external_net:
self._assert_on_external_net_with_compute(port_data)
# Do this outside of the context writer scope so it can overcome
# failures
if port.get('tenant_id'):
self._ensure_default_security_group(context, port['tenant_id'])
with db_api.CONTEXT_WRITER.using(context):
neutron_db = self.base_create_port(context, port)
port["port"].update(neutron_db)

View File

@ -1545,6 +1545,11 @@ class NsxV3Plugin(nsx_plugin_common.NsxPluginV3Base,
context, port_data, port_data['network_id'],
projectpluginmap.NsxPlugins.NSX_T)
# Do this outside of the context writer scope so it can overcome
# failures
if port.get('tenant_id'):
self._ensure_default_security_group(context, port['tenant_id'])
with db_api.CONTEXT_WRITER.using(context):
neutron_db = self.base_create_port(context, port)
port["port"].update(neutron_db)