From 4cc84d13c076c6089ec60fcea78aa908ac637045 Mon Sep 17 00:00:00 2001 From: limon Date: Wed, 10 Mar 2021 14:33:11 +0100 Subject: [PATCH] Fixes the collection of cpu metric in some openstack versions Change-Id: I147d8a1b1a14dfd9cb4cd238fcae929adc0484cf Signed-off-by: limon --- osm_mon/collector/vnf_collectors/openstack.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osm_mon/collector/vnf_collectors/openstack.py b/osm_mon/collector/vnf_collectors/openstack.py index 6c6bb58..a5c4980 100644 --- a/osm_mon/collector/vnf_collectors/openstack.py +++ b/osm_mon/collector/vnf_collectors/openstack.py @@ -219,9 +219,9 @@ class GnocchiBackend(OpenstackBackend): resource_id=resource_id) if measures: value = measures[-1][2] - except (gnocchiclient.exceptions.NotFound, TypeError) as e: + except (gnocchiclient.exceptions.NotFound, gnocchiclient.exceptions.BadRequest, TypeError) as e: # CPU metric in previous Openstack versions do not support rate:mean aggregation method - # Gnocchi in some Openstack versions raise TypeError instead of NotFound + # Gnocchi in some Openstack versions raise TypeError instead of NotFound or BadRequest if openstack_metric_name == "cpu": log.debug("No metric %s found for instance %s: %s", openstack_metric_name, resource_id, e) log.info("Retrying to get metric %s for instance %s without aggregation", -- 2.25.1