Change in vdsm[ovirt-3.6.3]: storage: Clean up image links during teardownImage

amureini at redhat.com amureini at redhat.com
Sun Mar 27 07:56:26 UTC 2016


Hello Nir Soffer, Adam Litke, Francesco Romani,

I'd like you to do a code review.  Please visit

    https://gerrit.ovirt.org/55286

to review the following change.

Change subject: storage: Clean up image links during teardownImage
......................................................................

storage: Clean up image links during teardownImage

In commit 736ab9 we began cleaning up volume links that were created in
/var/run/vdsm/images/... Unfortunately on block domains we are leaving
around a broken symlink in /rhev/data-center/... in some cases and this
will cause storage operations related to a disk of a VM that was
previously running to fail on this host.  The solution is to also remove
this broken symlink during teardownImage.

Change-Id: I5fb871f3ccd785c555c72db34ab818c04d000534
Bug-Url: https://bugzilla.redhat.com/1321444
Signed-off-by: Adam Litke <alitke at redhat.com>
Reviewed-on: https://gerrit.ovirt.org/55164
Reviewed-by: Nir Soffer <nsoffer at redhat.com>
Continuous-Integration: Jenkins CI
Reviewed-by: Francesco Romani <fromani at redhat.com>
---
M vdsm/storage/blockSD.py
M vdsm/storage/fileSD.py
M vdsm/storage/hsm.py
3 files changed, 11 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/86/55286/1

diff --git a/vdsm/storage/blockSD.py b/vdsm/storage/blockSD.py
index 86a3a94..8d953e0 100644
--- a/vdsm/storage/blockSD.py
+++ b/vdsm/storage/blockSD.py
@@ -1082,6 +1082,12 @@
                 raise
         return dst
 
+    def unlinkBCImage(self, imgUUID):
+        img_path = self.getLinkBCImagePath(imgUUID)
+        if os.path.islink(img_path):
+            self.log.debug("Removing image directory link %r", img_path)
+            os.unlink(img_path)
+
     def createImageLinks(self, srcImgPath, imgUUID, volUUIDs):
         """
         qcow chain is build by reading each qcow header and reading the path
diff --git a/vdsm/storage/fileSD.py b/vdsm/storage/fileSD.py
index 7f9ae17..ada292d 100644
--- a/vdsm/storage/fileSD.py
+++ b/vdsm/storage/fileSD.py
@@ -496,6 +496,10 @@
         # Nothing to do here other than returning the path
         return self.getLinkBCImagePath(imgUUID)
 
+    def unlinkBCImage(self, imgUUID):
+        # Nothing to do since linkBCImage is a no-op
+        pass
+
     def createImageLinks(self, srcImgPath, imgUUID):
         """
         qcow chain is build by reading each qcow header and reading the path
diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py
index f8eb3e5..3a04424 100644
--- a/vdsm/storage/hsm.py
+++ b/vdsm/storage/hsm.py
@@ -3265,6 +3265,7 @@
         vars.task.getSharedLock(STORAGE, sdUUID)
 
         dom = sdCache.produce(sdUUID)
+        dom.unlinkBCImage(imgUUID)
         dom.deactivateImage(imgUUID)
 
     @public


-- 
To view, visit https://gerrit.ovirt.org/55286
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5fb871f3ccd785c555c72db34ab818c04d000534
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.6.3
Gerrit-Owner: Allon Mureinik <amureini at redhat.com>
Gerrit-Reviewer: Adam Litke <alitke at redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Nir Soffer <nsoffer at redhat.com>


More information about the vdsm-patches mailing list