Only ensure default security group exists if necessary
A default security group will be assigned to a port if and only if the security group attribute is not set on the port being created. If the attribute is set then we do not need all of the extra logic of ensuring that the default security group exists. This change save a few cycles, more specifically we do not need to read from the DB or create a default security group if the default will not be used. TrivialFix Change-Id: Ib072c2753862ce0709a67942527e9c6241130042
This commit is contained in:
parent
d83ef90d7d
commit
71d9aab87e
|
@ -787,9 +787,9 @@ class SecurityGroupDbMixin(ext_sg.SecurityGroupPluginBase):
|
|||
port = port['port']
|
||||
if port.get('device_owner') and net.is_port_trusted(port):
|
||||
return
|
||||
default_sg = self._ensure_default_security_group(context,
|
||||
port['tenant_id'])
|
||||
if not validators.is_attr_set(port.get(ext_sg.SECURITYGROUPS)):
|
||||
default_sg = self._ensure_default_security_group(context,
|
||||
port['tenant_id'])
|
||||
port[ext_sg.SECURITYGROUPS] = [default_sg]
|
||||
|
||||
def _check_update_deletes_security_groups(self, port):
|
||||
|
|
Loading…
Reference in New Issue