summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHemna <waboring@hemna.com>2021-04-26 14:47:52 -0400
committerHemna <waboring@hemna.com>2021-04-26 14:47:52 -0400
commit60f6c5e8f5acab2d74fefba013220757adb9e50b (patch)
tree0dcd914167326d44b3d4975124f09387f5c7ac12
parentb75a126ec639d96e3fd76816fdd8f2ae70d3048b (diff)
downloadoslo-vmware-60f6c5e8f5acab2d74fefba013220757adb9e50b.tar.gz
Ignore already deleted lease3.9.0
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
-rw-r--r--oslo_vmware/rw_handles.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/oslo_vmware/rw_handles.py b/oslo_vmware/rw_handles.py
index e3769ec..a7b3e72 100644
--- a/oslo_vmware/rw_handles.py
+++ b/oslo_vmware/rw_handles.py
@@ -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.",