diff options
author | Bin Yang <bin.yang@windriver.com> | 2019-08-28 03:47:27 +0000 |
---|---|---|
committer | Bin Yang <bin.yang@windriver.com> | 2019-08-28 09:12:10 +0000 |
commit | 5478615a08971455605dcb1c35a73872ffd82f4c (patch) | |
tree | 7c95f62b432f5d97fdf703b41186ab1454bcb736 | |
parent | 9b0ce8f730becd6f5a1bd5048c247fb3cf4b728a (diff) |
Fix unregistration error
Change-Id: I907239e0d3f54bdd8cab6103cb3525626e629e39
Issue-ID: MULTICLOUD-793
Signed-off-by: Bin Yang <bin.yang@windriver.com>
-rw-r--r-- | share/common/msapi/helper.py | 2 | ||||
-rw-r--r-- | share/newton_base/registration/registration.py | 6 | ||||
-rw-r--r-- | share/starlingx_base/registration/registration.py | 19 |
3 files changed, 17 insertions, 10 deletions
diff --git a/share/common/msapi/helper.py b/share/common/msapi/helper.py index da730d0d..89fe3547 100644 --- a/share/common/msapi/helper.py +++ b/share/common/msapi/helper.py @@ -347,7 +347,7 @@ class MultiCloudThreadHelper(object): worker = item.get("worker", None) payload = item.get("payload", None) try: - item["status"] = worker(*payload) or 0 + returncode, item["status"] = worker(*payload) or (0, "Succeed") except Exception as e: item["status"] = e.message cache_item_for_query = { diff --git a/share/newton_base/registration/registration.py b/share/newton_base/registration/registration.py index 5656c6b6..51e2eb4c 100644 --- a/share/newton_base/registration/registration.py +++ b/share/newton_base/registration/registration.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2018 Wind River Systems, Inc. +# Copyright (c) 2017-2019 Wind River Systems, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -119,9 +119,9 @@ class Registry(APIView): backlog_item = { "id": vimid, "worker": self.register_helper.unregistryV0, - "payload": (vimid), + "payload": (vimid,), # important to add , at the end "repeat": 0, - "status": (1, "The de-registration is on process") + "status": (1, "The de-registration is in progress") } self.register_thread.add(backlog_item) if 0 == self.register_thread.state(): diff --git a/share/starlingx_base/registration/registration.py b/share/starlingx_base/registration/registration.py index ebd2109c..e953f9b3 100644 --- a/share/starlingx_base/registration/registration.py +++ b/share/starlingx_base/registration/registration.py @@ -253,16 +253,23 @@ class RegistryHelper(newton_registration.RegistryHelper): self._logger.debug("update cloud region fails %s" % e.message) try: - super(RegistryHelper, self).registryV0(vimid, project_idorname) + return super(RegistryHelper, self).registryV0(vimid, project_idorname) except Exception as e: - self._logger.debug("registryV0 fails %s" % e.message) + errmsg = "registryV0 fails %s" % str(e) + self._logger.debug(errmsg) + return 11, errmsg - return 0 - - def unregistry(self, vimid=""): + def unregistryV0(self, vimid=""): '''extend base method''' - return self.super(RegistryHelper, self).unregistry(vimid) + try: + return super(RegistryHelper, self).unregistryV0(vimid) + except Exception as e: + errmsg = "unregistryV0 fails %s" % str(e) + self._logger.debug(errmsg) + return 11, errmsg + + # return (0, "Succeed") def _get_ovsdpdk_capabilities(self, extra_specs, viminfo): '''extend base method''' |