summaryrefslogtreecommitdiffstats
path: root/windriver/titanium_cloud/resource
diff options
context:
space:
mode:
Diffstat (limited to 'windriver/titanium_cloud/resource')
-rw-r--r--windriver/titanium_cloud/resource/views/capacity.py13
-rw-r--r--windriver/titanium_cloud/resource/views/events.py13
2 files changed, 16 insertions, 10 deletions
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"
diff --git a/windriver/titanium_cloud/resource/views/events.py b/windriver/titanium_cloud/resource/views/events.py
index 0c413e57..c65a188f 100644
--- a/windriver/titanium_cloud/resource/views/events.py
+++ b/windriver/titanium_cloud/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}
-
- 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 servers detail info
req_resouce = "/servers/detail"