summaryrefslogtreecommitdiffstats
path: root/share/newton_base/registration/registration.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/registration/registration.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/registration/registration.py')
-rw-r--r--share/newton_base/registration/registration.py21
1 files changed, 17 insertions, 4 deletions
diff --git a/share/newton_base/registration/registration.py b/share/newton_base/registration/registration.py
index c3aaec24..41fe5733 100644
--- a/share/newton_base/registration/registration.py
+++ b/share/newton_base/registration/registration.py
@@ -41,7 +41,10 @@ class Registry(APIView):
vimid, content_key):
service = {'service_type': service_type,
'interface': 'public',
- 'region_id': viminfo['cloud_region_id']}
+ 'region_id': viminfo['openstack_region_id']
+ if viminfo.get('openstack_region_id')
+ else viminfo['cloud_region_id']}
+
self._logger.info("making request with URI:%s" % resource_url)
resp = session.get(resource_url, endpoint_filter=service)
self._logger.info("request returns with status %s" % resp.status_code)
@@ -248,7 +251,11 @@ class Registry(APIView):
req_resource = schema
service = {'service_type': "image",
'interface': 'public',
- 'region_id': viminfo['cloud_region_id']}
+ 'region_id': viminfo['openstack_region_id']
+ if viminfo.get('openstack_region_id')
+ else viminfo['cloud_region_id']
+ }
+
self._logger.info("making request with URI:%s" % req_resource)
resp = session.get(req_resource, endpoint_filter=service)
self._logger.info("request returns with status %s" % resp.status_code)
@@ -291,7 +298,11 @@ class Registry(APIView):
req_resource = "/os-hypervisors/detail?hypervisor_hostname_pattern=%s" % k
service = {'service_type': "compute",
'interface': 'public',
- 'region_id': viminfo['cloud_region_id']}
+ 'region_id': viminfo['openstack_region_id']
+ if viminfo.get('openstack_region_id')
+ else viminfo['cloud_region_id']
+ }
+
self._logger.info("making request with URI:%s" % req_resource)
resp = session.get(req_resource, endpoint_filter=service)
self._logger.info("request returns with status %s" % resp.status_code)
@@ -558,7 +569,9 @@ class Registry(APIView):
# add resource-version to url
if retcode == 0 and content:
viminfo = json.JSONDecoder().decode(content)
- viminfo['identity-url'] = self.proxy_prefix + "/%s/identity/v2.0" % vimid
+ viminfo['identity-url'] = self.proxy_prefix + "/%s/identity/v2.0" % vimid \
+ if self.proxy_prefix[-3:] == "/v0" else \
+ self.proxy_prefix + "/%s/%s/identity/v2.0" % extsys.decode_vim_id(vimid)
retcode, content, status_code = \
restcall.req_to_aai("/cloud-infrastructure/cloud-regions/cloud-region/%s/%s"