summaryrefslogtreecommitdiffstats
path: root/share/newton_base/openoapi/volume.py
diff options
context:
space:
mode:
Diffstat (limited to 'share/newton_base/openoapi/volume.py')
-rw-r--r--share/newton_base/openoapi/volume.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/share/newton_base/openoapi/volume.py b/share/newton_base/openoapi/volume.py
index 827baea9..100d2392 100644
--- a/share/newton_base/openoapi/volume.py
+++ b/share/newton_base/openoapi/volume.py
@@ -76,6 +76,11 @@ class Volumes(APIView):
vim = VimDriverUtils.get_vim_info(vimid)
sess = VimDriverUtils.get_session(vim, tenantid)
+
+ self.service['region_id'] = vim['openstack_region_id'] \
+ if vim.get('openstack_region_id') \
+ else vim['cloud_region_id']
+
logger.info("making request with URI:%s" % req_resouce)
resp = sess.get(req_resouce, endpoint_filter=self.service)
logger.info("request returns with status %s" % resp.status_code)
@@ -137,6 +142,11 @@ class Volumes(APIView):
VimDriverUtils.replace_key_by_mapping(volume,
self.keys_mapping, True)
req_body = json.JSONEncoder().encode({"volume": volume})
+
+ self.service['region_id'] = vim['openstack_region_id'] \
+ if vim.get('openstack_region_id') \
+ else vim['cloud_region_id']
+
logger.info("making request with URI:%s" % req_resouce)
logger.debug("with data:%s" % req_body)
resp = sess.post(req_resouce, data=req_body,
@@ -179,6 +189,11 @@ class Volumes(APIView):
vim = VimDriverUtils.get_vim_info(vimid)
sess = VimDriverUtils.get_session(vim, tenantid)
+
+ self.service['region_id'] = vim['openstack_region_id'] \
+ if vim.get('openstack_region_id') \
+ else vim['cloud_region_id']
+
logger.info("making request with URI:%s" % req_resouce)
resp = sess.delete(req_resouce, endpoint_filter=self.service)
logger.info("request returns with status %s" % resp.status_code)