summaryrefslogtreecommitdiffstats
path: root/share/newton_base/openoapi/subnet.py
diff options
context:
space:
mode:
authorBin Yang <bin.yang@windriver.com>2018-08-16 04:32:18 +0000
committerBin Yang <bin.yang@windriver.com>2018-08-17 06:21:56 +0000
commit591cdc9da7149fa4e68eac0de2efa8efd25281d6 (patch)
treefa75681ece5154f4215d78f104661fa99419b504 /share/newton_base/openoapi/subnet.py
parent400e1b7c35a1db4cdcf20f4453631bc0888a330f (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 'share/newton_base/openoapi/subnet.py')
-rw-r--r--share/newton_base/openoapi/subnet.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/share/newton_base/openoapi/subnet.py b/share/newton_base/openoapi/subnet.py
index 9ff61f2a..1d4f761b 100644
--- a/share/newton_base/openoapi/subnet.py
+++ b/share/newton_base/openoapi/subnet.py
@@ -75,6 +75,11 @@ class Subnets(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)
@@ -136,6 +141,11 @@ class Subnets(APIView):
VimDriverUtils.replace_key_by_mapping(subnet,
self.keys_mapping, True)
req_body = json.JSONEncoder().encode({"subnet": subnet})
+
+ 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,
@@ -180,6 +190,11 @@ class Subnets(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)