diff options
author | Xiaohua Zhang <xiaohua.zhang@windriver.com> | 2018-10-09 01:51:37 +0000 |
---|---|---|
committer | Xiaohua Zhang <xiaohua.zhang@windriver.com> | 2018-10-09 01:52:52 +0000 |
commit | 5a1608bfe48b2ac2a402e70b55df6602f2638527 (patch) | |
tree | 8e3b562459929fad4087c6eba190991b0f8c354d /windriver/titanium_cloud/registration/views | |
parent | 280d4850a9ed44721b25c0978a48a02072a1527c (diff) |
Fix AAI update sync up issue
Read after write to make sure the update to AAI obejct
has been visible to following AAI queries
Change-Id: I34982e53ca2e2bad60e4740f3d8f55775dae55b9
Issue-ID: MULTICLOUD-371
Signed-off-by: Xiaohua Zhang <xiaohua.zhang@windriver.com>
Diffstat (limited to 'windriver/titanium_cloud/registration/views')
-rw-r--r-- | windriver/titanium_cloud/registration/views/registration.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/windriver/titanium_cloud/registration/views/registration.py b/windriver/titanium_cloud/registration/views/registration.py index 1d560e4e..57888456 100644 --- a/windriver/titanium_cloud/registration/views/registration.py +++ b/windriver/titanium_cloud/registration/views/registration.py @@ -100,7 +100,9 @@ class APIv1Registry(newton_registration.Registry): "cloud-region-id": cloud_region_id, "cloud-type": viminfo["type"], "cloud-region-version": viminfo["version"], - "identity-url": self.proxy_prefix + "/%s/%s/identity/v2.0" % (cloud_owner, cloud_region_id), + "identity-url": self.proxy_prefix + "/%s_%s/identity/v2.0" % (cloud_owner, cloud_region_id) \ + if self.proxy_prefix[-3:] == "/v0" else \ + self.proxy_prefix + "/%s/%s/identity/v2.0" % (cloud_owner, cloud_region_id), "complex-name": viminfo["complex-name"], "cloud-extra-info": viminfo["cloud_extra_info"], "cloud-epa-caps":openstack_region_id, @@ -156,6 +158,17 @@ class APIv1Registry(newton_registration.Registry): "content": content, "status_code": status_code, }) + + # wait and confirm the update has been available for next AAI calls + while True: + # get cloud-region + retcode2, content2, status_code2 = \ + restcall.req_to_aai(resource_url, "GET") + if retcode2 == 0 and content2: + content2 = json.JSONDecoder().decode(content2) + if content2.get("identity-url", None) == resource_info.get("identity-url", None): + break + return retcode return 1 # unknown cloud owner,region_id |