From 85f069b762d0307477b15bf370efd011ddd1670f Mon Sep 17 00:00:00 2001 From: Anna Reznikov Date: Thu, 30 Aug 2018 08:58:17 +0000 Subject: [PATCH] fix port filtering Change-Id: I1989450719294387b4cc48662a5cbd6c7711b3d1 --- vitrage/datasources/neutron/port/driver.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/vitrage/datasources/neutron/port/driver.py b/vitrage/datasources/neutron/port/driver.py index fa53aef2a..3ca08150f 100644 --- a/vitrage/datasources/neutron/port/driver.py +++ b/vitrage/datasources/neutron/port/driver.py @@ -29,9 +29,13 @@ class PortDriver(NeutronBase): def enrich_event(self, event, event_type): event[DSProps.EVENT_TYPE] = event_type + if 'compute' not in event.get('port', {}).get('device_owner', ''): + return [] - return PortDriver.make_pickleable([event], NEUTRON_PORT_DATASOURCE, - DatasourceAction.UPDATE)[0] + enriched_event = \ + PortDriver.make_pickleable([event], NEUTRON_PORT_DATASOURCE, + DatasourceAction.UPDATE)[0] + return enriched_event @staticmethod def properties_to_filter_out(): @@ -40,7 +44,7 @@ class PortDriver(NeutronBase): def get_all(self, datasource_action): ports = self.client.list_ports()['ports'] - ports = [p for p in ports if p.get('device_owner') == 'compute:nova'] + ports = [p for p in ports if 'compute' in p.get('device_owner', '')] return self.make_pickleable( ports, NEUTRON_PORT_DATASOURCE,