diff options
author | Bin Yang <bin.yang@windriver.com> | 2018-08-16 04:32:18 +0000 |
---|---|---|
committer | Bin Yang <bin.yang@windriver.com> | 2018-08-17 06:21:56 +0000 |
commit | 591cdc9da7149fa4e68eac0de2efa8efd25281d6 (patch) | |
tree | fa75681ece5154f4215d78f104661fa99419b504 /ocata | |
parent | 400e1b7c35a1db4cdcf20f4453631bc0888a330f (diff) |
multi-region discovery
Decouple the openstack region id from cloud-region-id
Change-Id: If4bfacf05d87ca4bc97a485d4153f4f379ad451a
Issue-ID: MULTICLOUD-311
Signed-off-by: Bin Yang <bin.yang@windriver.com>
Diffstat (limited to 'ocata')
-rw-r--r-- | ocata/ocata/resource/views/capacity.py | 11 | ||||
-rw-r--r-- | ocata/ocata/resource/views/events.py | 11 |
2 files changed, 14 insertions, 8 deletions
diff --git a/ocata/ocata/resource/views/capacity.py b/ocata/ocata/resource/views/capacity.py index 37c920e4..b1f31913 100644 --- a/ocata/ocata/resource/views/capacity.py +++ b/ocata/ocata/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} + 'region_id': vim['openstack_region_id'] + if vim.get('openstack_region_id') + else vim['cloud_region_id']} - tenant_name = None - vim = VimDriverUtils.get_vim_info(vimid) - sess = VimDriverUtils.get_session(vim, tenant_name) #get limit for this tenant req_resouce = "/limits" diff --git a/ocata/ocata/resource/views/events.py b/ocata/ocata/resource/views/events.py index 3cfdad4a..4b477a75 100644 --- a/ocata/ocata/resource/views/events.py +++ b/ocata/ocata/resource/views/events.py @@ -44,16 +44,19 @@ class EventsCheck(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} + 'region_id': vim['openstack_region_id'] + if vim.get('openstack_region_id') + else vim['cloud_region_id']} - tenant_name = None - vim = VimDriverUtils.get_vim_info(vimid) - sess = VimDriverUtils.get_session(vim, tenant_name) # get servers detail info req_resouce = "/servers/detail" |