Bug 2238 - Fix metric collection from VIO 57/13257/1
authorPatricia Reinoso <patricia.reinoso@canonical.com>
Fri, 21 Apr 2023 14:47:29 +0000 (14:47 +0000)
committerPatricia Reinoso <patricia.reinoso@canonical.com>
Fri, 21 Apr 2023 14:47:29 +0000 (14:47 +0000)
Change-Id: Ia767f7c05d479dffc244b6f19539d98678da52a0
Signed-off-by: Patricia Reinoso <patricia.reinoso@canonical.com>
osm_mon/collector/service.py

index 314ce11..2a34842 100644 (file)
@@ -90,7 +90,9 @@ class CollectorService:
         vim_type = CollectorService._get_vim_type(conf, vim_account_id)
         log.debug("vim type.....{}".format(vim_type))
         if vim_type in VIM_COLLECTORS:
-            collector = VIM_COLLECTORS[vim_type](conf, vim_account_id, vim_sess_map[vim_account_id])
+            collector = VIM_COLLECTORS[vim_type](
+                conf, vim_account_id, vim_sess_map[vim_account_id]
+            )
             metrics = collector.collect(vnfr)
             log.debug("Collecting vim metrics.....{}".format(metrics))
         else:
@@ -166,7 +168,11 @@ class CollectorService:
             vim_type = CollectorService._get_vim_type(self.conf, vim["_id"])
             if vim_type in VIM_INFRA_COLLECTORS:
                 collector = VIM_INFRA_COLLECTORS[vim_type](self.conf, vim["_id"])
-                vim_sess = collector.vim_session if vim_type == "openstack" else None
+                vim_sess = (
+                    collector.vim_session
+                    if (vim_type == "openstack" or vim_type == "vio")
+                    else None
+                )
                 # Populate the vim session map with vim ids and corresponding session objects
                 # vim session objects are stopred only for vim type openstack
                 if vim_sess:
@@ -176,7 +182,9 @@ class CollectorService:
         # Starting executor pool with pool size process_pool_size. Default process_pool_size is 20
         # init_session is called to assign the session map to the gloabal vim session map variable
         with concurrent.futures.ProcessPoolExecutor(
-            self.conf.get("collector", "process_pool_size"), initializer=init_session, initargs=(vim_sess_map,)
+            self.conf.get("collector", "process_pool_size"),
+            initializer=init_session,
+            initargs=(vim_sess_map,),
         ) as executor:
             log.info(
                 "Started metric collector process pool with pool size %s"