diff options
-rw-r--r-- | share/common/msapi/helper.py | 11 | ||||
-rw-r--r-- | share/newton_base/proxy/identityV3.py | 20 | ||||
-rw-r--r-- | share/starlingx_base/resource/infra_workload.py | 7 |
3 files changed, 31 insertions, 7 deletions
diff --git a/share/common/msapi/helper.py b/share/common/msapi/helper.py index 69b91953..de8852c8 100644 --- a/share/common/msapi/helper.py +++ b/share/common/msapi/helper.py @@ -281,6 +281,15 @@ class MultiCloudThreadHelper(object): return False + def expire(self, backlog_id): + # important: the order of operation should make sure + # there is at least 1 copy of backlog item in either backlog or expired backlog + # self.lock.acquire() + backlogitem = self.backlog.get(backlog_id, None) + self.owner.expired_backlog[backlog_id] = backlogitem + self.backlog.pop(backlog_id, None) + # self.lock.release() + def remove(self, backlog_id): # self.lock.acquire() self.backlog.pop(backlog_id, None) @@ -345,7 +354,7 @@ class MultiCloudThreadHelper(object): "status": item["status"] } if item.get("repeat", 0) == 0: - self.owner.remove(backlog_id) + self.owner.expire(backlog_id) # keep only the id and status self.owner.expired_backlog[backlog_id] = {"status": item["status"]} diff --git a/share/newton_base/proxy/identityV3.py b/share/newton_base/proxy/identityV3.py index 5d502831..6539943b 100644 --- a/share/newton_base/proxy/identityV3.py +++ b/share/newton_base/proxy/identityV3.py @@ -62,6 +62,12 @@ class Tokens(APIView): self._logger.debug("data> %s" % request.data) self._logger.info("RESP with status> %s" % status.HTTP_200_OK) + + # compose the links + v3_version_detail["version"]["links"] = [{ + "href": request.META.get("REQUEST_URI", ""), + "rel": "self" + }] return Response(data=v3_version_detail, status=status.HTTP_200_OK) def post(self, request, vimid=""): @@ -161,8 +167,8 @@ class Tokens(APIView): v2_version_detail = { "version": { - "status": "stable", - "updated": "2014-04-17T00:00:00Z", + "status": "deprecated", + "updated": "2016-08-04T00:00:00Z", "media-types": [ { "base": "application/json", @@ -171,7 +177,10 @@ v2_version_detail = { ], "id": "v2.0", "links": [ - ] + ], + "type": "text/html", + "rel": "describedby" + } } @@ -189,6 +198,11 @@ class TokensV2(Tokens): self._logger.debug("TokensV2--get::META> %s" % request.META) self._logger.info("RESP with status> %s" % status.HTTP_200_OK) + # compose the links + v2_version_detail["version"]["links"] = [{ + "href": request.META.get("REQUEST_URI", ""), + "rel": "self" + }] return Response(data=v2_version_detail, status=status.HTTP_200_OK) def post(self, request, vimid=""): diff --git a/share/starlingx_base/resource/infra_workload.py b/share/starlingx_base/resource/infra_workload.py index af5f5531..48990d28 100644 --- a/share/starlingx_base/resource/infra_workload.py +++ b/share/starlingx_base/resource/infra_workload.py @@ -125,7 +125,7 @@ class InfraWorkload(newton_infra_workload.InfraWorkload): else: progress = backlog_item.get( "status", - (13, "DELETE_FAILED", + (13, "UPDATE_FAILED", "Unexpected:status not found in backlog item") ) @@ -136,9 +136,10 @@ class InfraWorkload(newton_infra_workload.InfraWorkload): resp_template["workload_status"] = progress_status resp_template["workload_status_reason"] = progress_msg - status_code = status.HTTP_200_ACCEPTED\ + status_code = status.HTTP_202_ACCEPTED\ if progress_code == 0 else progress_code except Exception as e: + self._logger.warn("Exception: %s" % e.message) resp_template["workload_status_reason"] = progress return Response(data=resp_template, status=status_code) @@ -332,7 +333,7 @@ class InfraWorkload(newton_infra_workload.InfraWorkload): resp_template["workload_status"] = progress_status resp_template["workload_status_reason"] = progress_msg - status_code = status.HTTP_200_ACCEPTED \ + status_code = status.HTTP_202_ACCEPTED \ if progress_code == 0 else progress_code except Exception as e: resp_template["workload_status_reason"] = progress |