X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osm_mon%2Fcollector%2Fvnf_collectors%2Fopenstack.py;h=d1cd2a17387ddd48480328b5f1eb49a38ea07544;hb=eba6065d11b0f5ab76b4cda867a21aa5a8b4c092;hp=122fdd65cf767c3dda5437598b1fce564baf92aa;hpb=a69f2725ddb055a25570deb1f2a14d28ff38314e;p=osm%2FMON.git diff --git a/osm_mon/collector/vnf_collectors/openstack.py b/osm_mon/collector/vnf_collectors/openstack.py index 122fdd6..d1cd2a1 100644 --- a/osm_mon/collector/vnf_collectors/openstack.py +++ b/osm_mon/collector/vnf_collectors/openstack.py @@ -28,6 +28,7 @@ from ceilometerclient import client as ceilometer_client from ceilometerclient.exc import HTTPException from gnocchiclient.v1 import client as gnocchi_client from keystoneclient.v3 import client as keystone_client +from keystoneauth1.exceptions.catalog import EndpointNotFound from neutronclient.v2_0 import client as neutron_client from osm_mon.collector.metric import Metric @@ -84,7 +85,10 @@ class OpenstackCollector(BaseVimCollector): # Populate extra tags for metrics tags = {} tags['ns_name'] = self.common_db.get_nsr(nsr_id)['name'] - tags['project_id'] = vnfr['_admin']['projects_read'][0] + if vnfr['_admin']['projects_read']: + tags['project_id'] = vnfr['_admin']['projects_read'][0] + else: + tags['project_id'] = None metrics = [] for vdur in vnfr['vdur']: @@ -125,7 +129,7 @@ class OpenstackCollector(BaseVimCollector): ceilometer = CeilometerBackend(vim_account) ceilometer.client.capabilities.get() return ceilometer - except HTTPException: + except (HTTPException, EndpointNotFound): gnocchi = GnocchiBackend(vim_account) gnocchi.client.metric.list(limit=1) return gnocchi