fix port filtering

Change-Id: I1989450719294387b4cc48662a5cbd6c7711b3d1
This commit is contained in:
Anna Reznikov 2018-08-30 08:58:17 +00:00
parent 83df20dd27
commit 85f069b762

View File

@ -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,