From 591cdc9da7149fa4e68eac0de2efa8efd25281d6 Mon Sep 17 00:00:00 2001 From: Bin Yang Date: Thu, 16 Aug 2018 04:32:18 +0000 Subject: multi-region discovery Decouple the openstack region id from cloud-region-id Change-Id: If4bfacf05d87ca4bc97a485d4153f4f379ad451a Issue-ID: MULTICLOUD-311 Signed-off-by: Bin Yang --- windriver/titanium_cloud/resource/views/capacity.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'windriver/titanium_cloud/resource/views/capacity.py') diff --git a/windriver/titanium_cloud/resource/views/capacity.py b/windriver/titanium_cloud/resource/views/capacity.py index 74470ca2..1b4566c3 100644 --- a/windriver/titanium_cloud/resource/views/capacity.py +++ b/windriver/titanium_cloud/resource/views/capacity.py @@ -45,16 +45,19 @@ class CapacityCheck(APIView): try : resource_demand = request.data + tenant_name = None + vim = VimDriverUtils.get_vim_info(vimid) + sess = VimDriverUtils.get_session(vim, tenant_name) + #get token: cloud_owner, regionid = extsys.decode_vim_id(vimid) interface = 'public' service = {'service_type': 'compute', 'interface': interface, - 'region_id': regionid} - - tenant_name = None - vim = VimDriverUtils.get_vim_info(vimid) - sess = VimDriverUtils.get_session(vim, tenant_name) + 'region_id': vim['openstack_region_id'] + if vim.get('openstack_region_id') + else vim['cloud_region_id'] + } #get limit for this tenant req_resouce = "/limits" -- cgit 1.2.3-korg