From 5eecba06f3173ec8d163e34bff287a2b09e5829c Mon Sep 17 00:00:00 2001 From: Bin Yang Date: Thu, 28 Mar 2019 13:17:14 +0000 Subject: Initiate a thread to handle registry To prevent the registry API timeout by offloading the time-consuming registry to a thread Change-Id: I1107bb7f3d9a11bdae4d0a5926f788bc2a534bda Issue-ID: MULTICLOUD-554 Signed-off-by: Bin Yang --- ocata/ocata/registration/tests/test_registration2.py | 12 ++++++++---- ocata/ocata/registration/views/registration.py | 2 ++ 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'ocata') diff --git a/ocata/ocata/registration/tests/test_registration2.py b/ocata/ocata/registration/tests/test_registration2.py index 757dccc0..bfb7d7a5 100644 --- a/ocata/ocata/registration/tests/test_registration2.py +++ b/ocata/ocata/registration/tests/test_registration2.py @@ -92,8 +92,10 @@ class TestRegistration2(unittest.TestCase): } ) - resp = self.view._discover_flavors(vimid="windriver-hudson-dc_RegionOne", - session=mock_session, viminfo=MOCK_VIM_INFO) + resp = self.view.register_helper._discover_flavors( + vimid="windriver-hudson-dc_RegionOne", + session=mock_session, viminfo=MOCK_VIM_INFO + ) self.assertIsNone(resp) @@ -110,7 +112,9 @@ class TestRegistration2(unittest.TestCase): } ), - resp = self.view._discover_flavors(vimid="windriver-hudson-dc_RegionOne", - session=mock_session, viminfo=MOCK_VIM_INFO) + resp = self.view.register_helper._discover_flavors( + vimid="windriver-hudson-dc_RegionOne", + session=mock_session, viminfo=MOCK_VIM_INFO + ) self.assertIsNone(resp) diff --git a/ocata/ocata/registration/views/registration.py b/ocata/ocata/registration/views/registration.py index 0de84d68..d54ea852 100644 --- a/ocata/ocata/registration/views/registration.py +++ b/ocata/ocata/registration/views/registration.py @@ -29,6 +29,7 @@ class Registry(newton_registration.Registry): self.proxy_prefix = settings.MULTICLOUD_PREFIX self.aai_base_url = settings.AAI_BASE_URL self._logger = logger + super(Registry, self).__init__() class RegistryV1(Registry): @@ -36,6 +37,7 @@ class RegistryV1(Registry): self.proxy_prefix = settings.MULTICLOUD_API_V1_PREFIX self.aai_base_url = settings.AAI_BASE_URL self._logger = logger + super(RegistryV1, self).__init__() def post(self, request, cloud_owner="", cloud_region_id=""): self._logger.info("registration with : %s, %s" % (cloud_owner, cloud_region_id)) -- cgit 1.2.3-korg