VMware: fix security group check on port create

The code did not consider an empty list among the cases
in which security groups are not supplied on port create.

Change-Id: I6e4ac3dee0d02c6c26977f8e2fee717587b8bfc5
Closes-Bug: #1405311
This commit is contained in:
Salvatore 2014-12-24 01:23:41 +01:00
parent 3a96a43c53
commit eb52e853c4
1 changed files with 4 additions and 1 deletions

View 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))