]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
VMware: fix security group check on port create
authorSalvatore <salv.orlando@gmail.com>
Wed, 24 Dec 2014 00:17:17 +0000 (01:17 +0100)
committerSalvatore <salv.orlando@gmail.com>
Mon, 29 Dec 2014 14:19:02 +0000 (15:19 +0100)
The code did not consider an empty list among the cases
in which security groups are not supplied on port create.

Change-Id: I325cce2165d2ec683ecac3cabdbfb80a03b288c9
Closes-Bug: #1405311

neutron/plugins/vmware/plugins/base.py

index e6387fe584f7c8bfb9f5cd3ecc92568e2883d016..1c81ff451f8a3c0ca2da9540aa6763d970a6e828 100644 (file)
@@ -1122,9 +1122,12 @@ class NsxPluginV2(addr_pair_db.AllowedAddressPairsMixin,
                 port_data[addr_pair.ADDRESS_PAIRS] = []
 
             # security group extension checks
+            # NOTE: check_update_has_security_groups works fine for
+            # create operations as well
             if port_security and has_ip:
                 self._ensure_default_security_group_on_port(context, port)
-            elif attr.is_attr_set(port_data.get(ext_sg.SECURITYGROUPS)):
+            elif self._check_update_has_security_groups(
+                 {'port': port_data}):
                 raise psec.PortSecurityAndIPRequiredForSecurityGroups()
             port_data[ext_sg.SECURITYGROUPS] = (
                 self._get_security_groups_on_port(context, port))