NSXV: ensure default SG
Ensure default security group during port and SG creation Change-Id: Ie0a46e08f603eb3647952ed7d2dbd76cc436601f
This commit is contained in:
parent
0388e7eb91
commit
1316d7e43a
@ -2097,6 +2097,12 @@ class NsxVPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
|||||||
direct_vnic_type = self._validate_port_vnic_type(
|
direct_vnic_type = self._validate_port_vnic_type(
|
||||||
context, port_data, port_data['network_id'])
|
context, port_data, port_data['network_id'])
|
||||||
|
|
||||||
|
# Do this outside of the context writer scope so it can overcome
|
||||||
|
# failures
|
||||||
|
if port_data.get('tenant_id'):
|
||||||
|
self._ensure_default_security_group(context,
|
||||||
|
port_data['tenant_id'])
|
||||||
|
|
||||||
with db_api.CONTEXT_WRITER.using(context):
|
with db_api.CONTEXT_WRITER.using(context):
|
||||||
# First we allocate port in neutron database
|
# First we allocate port in neutron database
|
||||||
neutron_db = super(NsxVPluginV2, self).create_port(context, port)
|
neutron_db = super(NsxVPluginV2, self).create_port(context, port)
|
||||||
@ -4531,6 +4537,9 @@ class NsxVPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
|||||||
def create_security_group(self, context, security_group, default_sg=False):
|
def create_security_group(self, context, security_group, default_sg=False):
|
||||||
"""Create a security group."""
|
"""Create a security group."""
|
||||||
sg_data = security_group['security_group']
|
sg_data = security_group['security_group']
|
||||||
|
if not default_sg:
|
||||||
|
self._ensure_default_security_group(context, sg_data['tenant_id'])
|
||||||
|
|
||||||
sg_id = sg_data["id"] = str(uuidutils.generate_uuid())
|
sg_id = sg_data["id"] = str(uuidutils.generate_uuid())
|
||||||
self._validate_security_group(context, sg_data, default_sg)
|
self._validate_security_group(context, sg_data, default_sg)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user