Fixes the collection of cpu metric in some openstack versions 72/10472/1
authorlimon <alimonj@indra.es>
Wed, 10 Mar 2021 13:33:11 +0000 (14:33 +0100)
committerlimon <alimonj@indra.es>
Wed, 10 Mar 2021 13:33:11 +0000 (14:33 +0100)
Change-Id: I147d8a1b1a14dfd9cb4cd238fcae929adc0484cf
Signed-off-by: limon <alimonj@indra.es>
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",