From 2a77e066bd5ad0628e2ed7733f19ccf2f3477a50 Mon Sep 17 00:00:00 2001 From: Patricia Reinoso Date: Fri, 21 Apr 2023 14:47:29 +0000 Subject: [PATCH] Bug 2238 - Fix metric collection from VIO Change-Id: Ia767f7c05d479dffc244b6f19539d98678da52a0 Signed-off-by: Patricia Reinoso --- osm_mon/collector/service.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/osm_mon/collector/service.py b/osm_mon/collector/service.py index 314ce11..2a34842 100644 --- a/osm_mon/collector/service.py +++ b/osm_mon/collector/service.py @@ -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" -- 2.25.1