Eduardo has uploaded a new change for review.

Change subject: Enable VM migration to old vdsm's.
......................................................................

Enable VM migration to old vdsm's.

Old vdsm's can't run VM from /var/run/vdsm/storage and rely on
/rhev/data-center hierarchy.

Change-Id: Ia778ad743a11b4c1d212857d8f25c81eb4c0defe
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1011608
Signed-off-by: Eduardo <[email protected]>
---
M vdsm/storage/blockSD.py
M vdsm/storage/fileSD.py
M vdsm/storage/hsm.py
3 files changed, 22 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/25/19825/1

diff --git a/vdsm/storage/blockSD.py b/vdsm/storage/blockSD.py
index d27f331..b014253 100644
--- a/vdsm/storage/blockSD.py
+++ b/vdsm/storage/blockSD.py
@@ -1029,6 +1029,19 @@
         vols, rems = self.getAllVolumesImages()
         return rems
 
+    def linkBCImage(self, imgPath, imgUUID):
+        dst = os.path.join(self.mountpoint, self.sdUUID, sd.DOMAIN_IMAGES,
+                           imgUUID)
+        try:
+            os.symlink(imgPath, dst)
+        except OSError as e:
+            if e.errno == errno.EEXIST:
+                self.log.debug("img run vol already exists: %s", dstVol)
+            else:
+                self.log.error("Failed to create img run vol: %s", dstVol)
+                raise
+        return dst
+
     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 8e788a5..8da30bb 100644
--- a/vdsm/storage/fileSD.py
+++ b/vdsm/storage/fileSD.py
@@ -418,6 +418,10 @@
         return dict((k, sd.ImgsPar(tuple(v['imgs']), v['parent']))
                     for k, v in volumes.iteritems())
 
+    def linkBCImage(self, imgPath, imgUUID):
+        return os.path.join(self.mountpoint, self.sdUUID, sd.DOMAIN_IMAGES,
+                              imgUUID)
+
     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 4f5a8a7..061182d 100644
--- a/vdsm/storage/hsm.py
+++ b/vdsm/storage/hsm.py
@@ -3230,8 +3230,12 @@
         # Filter volumes related to this image
         imgVolumes = sd.getVolsOfImage(allVols, imgUUID).keys()
         imgPath = dom.activateVolumes(imgUUID, imgVolumes)
+        if spUUID and spUUID != sd.BLANK_UUID:
+            runImgPath = dom.linkBCImage(imgPath, imgUUID)
+        else:
+            runImgPath = imgPath
 
-        leafPath = os.path.join(imgPath, leafUUID)
+        leafPath = os.path.join(runImgPath, leafUUID)
         for volUUID in imgVolumes:
             path = os.path.join(dom.domaindir, sd.DOMAIN_IMAGES, imgUUID,
                                 volUUID)


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

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

Reply via email to