Add exception for deleting an object in use

Change-Id: I636fda84ac8d273d83f6682fd7adb472ac0ae0ba
This commit is contained in:
Adit Sarfaty 2019-05-06 15:32:39 +03:00
parent 468c3effba
commit 00167c1cb1
2 changed files with 8 additions and 2 deletions

View File

@ -37,7 +37,8 @@ def http_error_to_exception(status_code, error_code):
requests.codes.BAD_REQUEST:
{'60508': exceptions.NsxIndexingInProgress,
'60514': exceptions.NsxSearchTimeout,
'500045': exceptions.NsxPendingDelete},
'500045': exceptions.NsxPendingDelete,
'500030': exceptions.ResourceInUse},
requests.codes.CONFLICT: exceptions.StaleRevision,
requests.codes.PRECONDITION_FAILED: exceptions.StaleRevision,
requests.codes.INTERNAL_SERVER_ERROR:

View File

@ -196,4 +196,9 @@ class NsxPendingDelete(NsxLibException):
class APITransactionAborted(ServerBusy):
message = _("API transaction aborted as MP cluster is reconfiguring.")
message = _("API transaction aborted as MP cluster is reconfiguring")
class ResourceInUse(ManagerError):
message = _("The object cannot be deleted as either it has children or it "
"is being referenced by other objects")