Zhou Zheng Sheng has uploaded a new change for review.

Change subject: avoid creating hangover in storage domain cache after formatting
......................................................................

avoid creating hangover in storage domain cache after formatting

HSM._recycle(self, dom) tries to delete the storage domain from cache by
calling "sdCache.manuallyRemoveDomain(dom.sdUUID)". This is OK, but when
it invokes "dom.format(dom.sdUUID)" to format storage domain, the "dom"
is a proxy object and have to look for the true storage domain object by
calling 'StorageDomainCache._realProduce()', thus cause the storage
domain added to the cache again. This bug will prevent us re-using the
storage domain UUID even though we format it.

This patch invokes the format method of the proxy object first, then
delete the storage domain from cache, and can avoid creating hangovers.

Change-Id: Ie13a97ad6830553cbd099189dfb82d6f02ce82fe
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=806774
Signed-off-by: Zhou Zheng Sheng <[email protected]>
---
M vdsm/storage/hsm.py
1 file changed, 7 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/44/8144/1

diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py
index a89274a..8512f08 100644
--- a/vdsm/storage/hsm.py
+++ b/vdsm/storage/hsm.py
@@ -2192,11 +2192,14 @@
     #TODO: Remove this  function when formatStorageDomain() is removed.
     def _recycle(self, dom):
         try:
-            sdCache.manuallyRemoveDomain(dom.sdUUID)
-        except KeyError:
-            self.log.warn("Storage domain %s doesn't exist in cache. Trying 
recycle leftovers ...", dom.sdUUID)
+            dom.format(dom.sdUUID)
+        finally:
+            try:
+                sdCache.manuallyRemoveDomain(dom.sdUUID)
+            except KeyError:
+                self.log.warn("Storage domain %s doesn't exist in cache. "
+                              "Trying recycle leftovers ...", dom.sdUUID)
 
-        dom.format(dom.sdUUID)
 
     @public
     def formatStorageDomain(self, sdUUID, autoDetach = False, options = None):


--
To view, visit http://gerrit.ovirt.org/8144
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie13a97ad6830553cbd099189dfb82d6f02ce82fe
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Zhou Zheng Sheng <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to