Fixes the collection of cpu metric in some openstack versions 74/10474/1
authorlimon <alimonj@indra.es>
Wed, 10 Mar 2021 13:33:11 +0000 (14:33 +0100)
committerpalsus <subhankar.pal@aricent.com>
Wed, 10 Mar 2021 16:40:33 +0000 (17:40 +0100)
Change-Id: I147d8a1b1a14dfd9cb4cd238fcae929adc0484cf
Signed-off-by: limon <alimonj@indra.es>
(cherry picked from commit 4cc84d13c076c6089ec60fcea78aa908ac637045)

osm_mon/collector/vnf_collectors/openstack.py

index 6c6bb58..a5c4980 100644 (file)
@@ -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",