Change in vdsm[master]: image: copy - set VM metadata images format to RAW

derez at redhat.com derez at redhat.com
Mon Nov 23 13:43:57 UTC 2015


Daniel Erez has uploaded a new change for review.

Change subject: image: copy - set VM metadata images format to RAW
......................................................................

image: copy - set VM metadata images format to RAW

Since commit 0b61c4851a528fd6354d9ab77a68085c41f35dc9
copy of internal raw volumes is done using 'qemu-img convert'
instead of invoking 'dd'.

Consequently, exporting VM metadata images (produce during
live snapshot) fails on qemu-img convert - since the images
'impersonate' to qcow2 (the format in .meta file is cow,
whereas the real format is raw).

Hence, we try to identify the VM metadata image on
'_interImagesCopy' and set its format to RAW
so qemuimg.convert could behave nicely.

This approach is a workaround since it's done merely to
conceal the aforementioned miscorrelation, however,
it seems to be simpler than fixing the root cause
(see https://gerrit.ovirt.org/#/c/48768/).

Change-Id: Icaad6599260a2631f580e17404d25554a19ec670
Bug-Url: https://bugzilla.redhat.com/1282239
Signed-off-by: Daniel Erez <derez at redhat.com>
---
M vdsm/storage/image.py
1 file changed, 16 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/02/49002/1

diff --git a/vdsm/storage/image.py b/vdsm/storage/image.py
index 956c805..c2a63ee 100644
--- a/vdsm/storage/image.py
+++ b/vdsm/storage/image.py
@@ -27,6 +27,7 @@
 import volume
 from vdsm import qemuimg
 from vdsm import virtsparsify
+from vdsm import constants
 from sdc import sdCache
 import sd
 import misc
@@ -458,7 +459,7 @@
                 try:
                     dstVol = destDom.produceVolume(imgUUID=imgUUID,
                                                    volUUID=srcVol.volUUID)
-                    srcFormat = volume.fmt2str(srcVol.getFormat())
+                    srcFormat = self._getSrcFormat(volume, srcVol)
                     dstFormat = volume.fmt2str(dstVol.getFormat())
 
                     parentVol = dstVol.getParentVolume()
@@ -493,6 +494,20 @@
             # teardown volumes
             self.__cleanupMove(srcLeafVol, dstLeafVol)
 
+    def _getSrcFormat(self, volume, srcVol):
+        imgInfo = qemuimg.info(srcVol.getVolumePath())
+        srcVirtualSizeInBytes = imgInfo['virtualsize']
+        srcFormatImgInfo = imgInfo['format']
+        srcFormatFromMeta = volume.fmt2str(srcVol.getFormat())
+
+        # VM metadata image format is RAW, whereas in .meta file it's COW:
+        # see bz#1282239
+        if srcFormatFromMeta != srcFormatImgInfo \
+                and srcVirtualSizeInBytes < constants.GIB:
+            return srcFormatImgInfo
+
+        return srcFormatFromMeta
+
     def _finalizeDestinationImage(self, destDom, imgUUID, chains, force):
         for srcVol in chains['srcChain']:
             try:


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icaad6599260a2631f580e17404d25554a19ec670
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Daniel Erez <derez at redhat.com>


More information about the vdsm-patches mailing list