[NEW PATCH] BZ#717952 - Fix race in moveImage with overwrite of VM with several disks on NFS domains (via gerrit-bot)

Igor Lvovsky ilvovsky at redhat.com
Tue Jul 12 15:35:28 UTC 2011


New patch submitted by Igor Lvovsky (ilvovsky at redhat.com)

You can review this change at: http://gerrit.usersys.redhat.com/646

commit e76296ddddfeecb08c56e2a3f1e9960751442b8a
Author: Igor Lvovsky <ilvovsky at redhat.com>
Date:   Tue Jul 5 16:00:21 2011 +0300

    BZ#717952 - Fix race in moveImage with overwrite of VM with several disks on NFS domains
    
    Change-Id: I367e83a700e84be0e4cb0ca5b7a02416cb54ac25

diff --git a/vdsm/storage/image.py b/vdsm/storage/image.py
index 51e237b..4fc6f5b 100644
--- a/vdsm/storage/image.py
+++ b/vdsm/storage/image.py
@@ -375,21 +375,26 @@ class Image:
         """
         Relink all hardlinks of the template 'volUUID' in all VMs based on it
         """
-        # Avoid relink templates for SAN domains
-        if destDom.getStorageType() in [ sd.NFS_DOMAIN ]:
-            vol = destDom.produceVolume(imgUUID=imgUUID, volUUID=volUUID)
-            chList = vol.getAllChildrenList(self.repoPath, destDom.sdUUID, imgUUID, volUUID)
-            for ch in chList:
-                # Remove hardlink of this template
-                v = destDom.produceVolume(imgUUID=ch['imgUUID'], volUUID=volUUID)
-                v.delete(postZero=False, force=True)
-
-                # Now we should re-link deleted hardlink, if exists
-                newVol = destDom.produceVolume(imgUUID=imgUUID, volUUID=volUUID)
-                imageDir = self.getImageDir(destDom.sdUUID, ch['imgUUID'])
-                newVol.share(imageDir)
-        else:
+        # Avoid relink templates for non-NFS domains
+        if destDom.getStorageType() not in [ sd.NFS_DOMAIN ]:
             self.log.debug("Doesn't relink templates non-NFS domain %s", destDom.sdUUID)
+            return
+
+        vol = destDom.produceVolume(imgUUID=imgUUID, volUUID=volUUID)
+        # Relink templates only
+        if not vol.isShared():
+            self.log.debug("Doesn't relink regular volume %s of image %s", volUUID, imgUUID)
+            return
+        chList = vol.getAllChildrenList(self.repoPath, destDom.sdUUID, imgUUID, volUUID)
+        for ch in chList:
+            # Remove hardlink of this template
+            v = destDom.produceVolume(imgUUID=ch['imgUUID'], volUUID=volUUID)
+            v.delete(postZero=False, force=True)
+
+            # Now we should re-link deleted hardlink, if exists
+            newVol = destDom.produceVolume(imgUUID=imgUUID, volUUID=volUUID)
+            imageDir = self.getImageDir(destDom.sdUUID, ch['imgUUID'])
+            newVol.share(imageDir)
 
     def createFakeTemplate(self, sdUUID, volParams):
         """




More information about the vdsm-patches mailing list