Ignore already deleted lease

When we try and release a lease, we might get an object not found
exception meaning that the lease doesn't exist.  So there is no need
to release something that doesn't exist.

Change-Id: I7912a7adf95f97074ee41441d7bfb8d2405b6533
This commit is contained in:
Hemna 2021-04-26 14:47:52 -04:00
parent b75a126ec6
commit 60f6c5e8f5
1 changed files with 8 additions and 0 deletions

View File

@ -556,6 +556,10 @@ class VmdkWriteHandle(VmdkHandle):
"""
try:
self._release_lease()
except exceptions.ManagedObjectNotFoundException:
LOG.info("Lease for %(url)s not found. No need to release.",
{'url': self._url})
return
except exceptions.VimException:
LOG.warning("Error occurred while releasing the lease "
"for %s.",
@ -637,6 +641,10 @@ class VmdkReadHandle(VmdkHandle):
"""
try:
self._release_lease()
except exceptions.ManagedObjectNotFoundException:
LOG.info("Lease for %(url)s not found. No need to release.",
{'url': self._url})
return
except exceptions.VimException:
LOG.warning("Error occurred while releasing the lease "
"for %s.",