diff options
Diffstat (limited to 'share/newton_base/openoapi/server.py')
-rw-r--r-- | share/newton_base/openoapi/server.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/share/newton_base/openoapi/server.py b/share/newton_base/openoapi/server.py index c5011f15..3e90bf84 100644 --- a/share/newton_base/openoapi/server.py +++ b/share/newton_base/openoapi/server.py @@ -63,6 +63,10 @@ class ServerVolumeAttachThread (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'] + #check if server is ready to attach logger.debug("Servers--attach_volume, wait for server to be ACTIVE::>%s" % serverid) req_resouce = "servers/%s" % serverid @@ -109,6 +113,10 @@ class ServerVolumeAttachThread (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'] + #wait server to be ready to detach volume # assume attachment id is the same as volume id @@ -159,6 +167,10 @@ class Servers(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'] + for volumeid in volumeIds: req_resouce = "servers/%s/os-volume_attachments/%s" % (serverId, volumeid) logger.debug("Servers--dettachVolume::>%s" % (req_resouce)) @@ -234,6 +246,11 @@ class Servers(APIView): vim = VimDriverUtils.get_vim_info(vimid) sess = VimDriverUtils.get_session(vim, tenantid) req_resouce = "servers/%s/os-interface" % serverid + + 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) @@ -258,6 +275,11 @@ class Servers(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) @@ -392,6 +414,11 @@ class Servers(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.post(req_resouce, data=req_body, endpoint_filter=self.service, @@ -450,6 +477,10 @@ class Servers(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'] + #check and dettach them if volumes attached to server server, status_code = self._get_servers("", vimid, tenantid, serverid) volumearray = server.pop("volumeArray", None) |