Fix INF-341 refactor name of resource pool to region id 26/9526/1
authorZhang Rong(Jon) <rong.zhang@windriver.com>
Tue, 8 Nov 2022 07:22:46 +0000 (15:22 +0800)
committerZhang Rong(Jon) <rong.zhang@windriver.com>
Tue, 8 Nov 2022 07:22:46 +0000 (15:22 +0800)
Issue-ID: INF-341
Signed-off-by: Zhang Rong(Jon) <rong.zhang@windriver.com>
Change-Id: I78c92df96a93e69e0fe1c359f434b1d4715e8d83

o2ims/adapter/clients/ocloud_client.py

index 7307bcc..eb42109 100644 (file)
@@ -283,7 +283,8 @@ class StxClientImp(object):
         if systems[0].distributed_cloud_role is None or \
                 systems[0].distributed_cloud_role != 'systemcontroller':
             return [ocloudModel.StxGenericModel(
-                ResourceTypeEnum.RESOURCE_POOL, systems[0])]
+                ResourceTypeEnum.RESOURCE_POOL,
+                self._respoolconverter(systems[0]))]
 
         pools = []
         if config.get_system_controller_as_respool():
@@ -305,7 +306,8 @@ class StxClientImp(object):
 
         return [ocloudModel.StxGenericModel(
             ResourceTypeEnum.RESOURCE_POOL,
-            respool) for respool in pools if respool]
+                self._respoolconverter(
+                    respool)) for respool in pools if respool]
 
     def getResourcePoolDetail(self, id):
         self.setStxClient(id)
@@ -524,6 +526,11 @@ class StxClientImp(object):
                                 'more than one system exists in the account.')
             return isystems[0]
 
+    @ staticmethod
+    def _respoolconverter(res_pool):
+        setattr(res_pool, 'name', res_pool.region_name)
+        return res_pool
+
     @ staticmethod
     def _hostconverter(host):
         setattr(host, 'name', host.hostname)