From: limon Date: Wed, 10 Mar 2021 13:33:11 +0000 (+0100) Subject: Fixes the collection of cpu metric in some openstack versions X-Git-Tag: v9.1.0~3 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=da86adfc1768bdf259eed467334947b64e5d902f;p=osm%2FMON.git Fixes the collection of cpu metric in some openstack versions Change-Id: I147d8a1b1a14dfd9cb4cd238fcae929adc0484cf Signed-off-by: limon (cherry picked from commit 4cc84d13c076c6089ec60fcea78aa908ac637045) --- 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",