NSX|V fix exclude list counting

When adding/removing a port to the exclude list, we check if there
are other ports of the same device there.
this test was done is a wrong way expecting the device owner to be
'compute:none', instead of starting with 'compute'

Change-Id: I5c6ed8f3c5cf0d4ebb63e1a9ec36614fa4c4f15b
This commit is contained in:
Adit Sarfaty 2017-10-16 19:15:50 +03:00
parent 5bbbc955be
commit 740826a513
1 changed files with 4 additions and 3 deletions

View File

@ -1686,9 +1686,10 @@ class NsxVPluginV2(addr_pair_db.AllowedAddressPairsMixin,
there are, so we can decide on adding / removing the device from
the exclusion list
"""
filters = {'device_id': [device_id],
'device_owner': ['compute:None']}
ports = self.get_ports(context.elevated(), filters=filters)
filters = {'device_id': [device_id]}
device_ports = self.get_ports(context.elevated(), filters=filters)
ports = [port for port in device_ports
if port['device_owner'].startswith('compute')]
return len([p for p in ports
if validators.is_attr_set(p.get(ext_vnic_idx.VNIC_INDEX))
and not p[psec.PORTSECURITY]])