diff options
Diffstat (limited to 'share/newton_base/openoapi/image.py')
-rw-r--r-- | share/newton_base/openoapi/image.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/share/newton_base/openoapi/image.py b/share/newton_base/openoapi/image.py index e27d0190..85615275 100644 --- a/share/newton_base/openoapi/image.py +++ b/share/newton_base/openoapi/image.py @@ -58,6 +58,10 @@ class imageThread (threading.Thread): 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'] + #open imageurl logger.info("making image put request with URI:%s" % req_resouce) resp = sess.put(req_resouce, endpoint_filter=self.service, data=imagefd.read(), @@ -113,6 +117,10 @@ class Images(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) @@ -186,6 +194,10 @@ class Images(APIView): #req_body = json.JSONEncoder().encode({"image": image}) req_body = json.JSONEncoder().encode(image) + 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, @@ -239,6 +251,10 @@ class Images(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) |