From 479e76c1f5dfb9b11df3472c5632d0e4d71aa454 Mon Sep 17 00:00:00 2001 From: Adit Sarfaty Date: Mon, 16 Oct 2017 19:15:50 +0300 Subject: [PATCH] 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 --- vmware_nsx/plugins/nsx_v/plugin.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/vmware_nsx/plugins/nsx_v/plugin.py b/vmware_nsx/plugins/nsx_v/plugin.py index 776852b558..f9e601ab7c 100644 --- a/vmware_nsx/plugins/nsx_v/plugin.py +++ b/vmware_nsx/plugins/nsx_v/plugin.py @@ -1820,9 +1820,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]])