From d0d6aebd5085caeced3838e9c24c2a274f893c27 Mon Sep 17 00:00:00 2001 From: agarwalat Date: Wed, 4 Nov 2020 05:18:46 +0000 Subject: [PATCH] Fix bug 1276: collect metric from gnocchi first then ceilometer if it fails Change-Id: I1313f24c9881071ae52adff7a4881ac4dcc38ee6 Signed-off-by: agarwalat --- osm_mon/collector/vnf_collectors/openstack.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osm_mon/collector/vnf_collectors/openstack.py b/osm_mon/collector/vnf_collectors/openstack.py index df0424b..7de93ec 100644 --- a/osm_mon/collector/vnf_collectors/openstack.py +++ b/osm_mon/collector/vnf_collectors/openstack.py @@ -142,15 +142,15 @@ class OpenstackCollector(BaseVimCollector): def _get_backend(self, vim_account: dict): try: - ceilometer = CeilometerBackend(vim_account) - ceilometer.client.capabilities.get() - log.info("Using ceilometer backend to collect metric") - return ceilometer - except (HTTPException, EndpointNotFound): gnocchi = GnocchiBackend(vim_account) gnocchi.client.metric.list(limit=1) log.info("Using gnocchi backend to collect metric") return gnocchi + except (HTTPException, EndpointNotFound): + ceilometer = CeilometerBackend(vim_account) + ceilometer.client.capabilities.get() + log.info("Using ceilometer backend to collect metric") + return ceilometer def _get_metric_type(self, metric_name: str, interface_name: str) -> MetricType: if metric_name not in INTERFACE_METRICS: -- 2.25.1