Change in vdsm[master]: image: fall-back to dd - workaround for bz#1282239

derez at redhat.com derez at redhat.com
Sun Nov 22 08:58:57 UTC 2015


Daniel Erez has uploaded a new change for review.

Change subject: image: fall-back to dd - workaround for bz#1282239
......................................................................

image: fall-back to dd - workaround for bz#1282239

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).

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: I3508f0cab1bc841dc8c7277146b2b54ff787f3ef
Bug-Url: https://bugzilla.redhat.com/1282239
Signed-off-by: Daniel Erez <derez at redhat.com>
---
M vdsm/storage/image.py
1 file changed, 27 insertions(+), 16 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/07/48907/1

diff --git a/vdsm/storage/image.py b/vdsm/storage/image.py
index 956c805..9bd7675 100644
--- a/vdsm/storage/image.py
+++ b/vdsm/storage/image.py
@@ -461,24 +461,35 @@
                     srcFormat = volume.fmt2str(srcVol.getFormat())
                     dstFormat = volume.fmt2str(dstVol.getFormat())
 
-                    parentVol = dstVol.getParentVolume()
+                    srcFormatFromMeta = qemuimg.info(
+                        srcVol.getVolumePath())['format']
+                    if srcFormatFromMeta == srcFormat:
+                        parentVol = dstVol.getParentVolume()
 
-                    if parentVol is not None:
-                        backing = volume.getBackingVolumePath(
-                            imgUUID, parentVol.volUUID)
-                        backingFormat = volume.fmt2str(parentVol.getFormat())
+                        if parentVol is not None:
+                            backing = volume.getBackingVolumePath(
+                                imgUUID, parentVol.volUUID)
+                            backingFormat = volume.fmt2str(
+                                parentVol.getFormat())
+                        else:
+                            backing = None
+                            backingFormat = None
+
+                        operation = qemuimg.convert(
+                            srcVol.getVolumePath(),
+                            dstVol.getVolumePath(),
+                            srcFormat=srcFormat,
+                            dstFormat=dstFormat,
+                            backing=backing,
+                            backingFormat=backingFormat)
+                        self._wait_for_qemuimg_operation(operation)
                     else:
-                        backing = None
-                        backingFormat = None
-
-                    operation = qemuimg.convert(
-                        srcVol.getVolumePath(),
-                        dstVol.getVolumePath(),
-                        srcFormat=srcFormat,
-                        dstFormat=dstFormat,
-                        backing=backing,
-                        backingFormat=backingFormat)
-                    self._wait_for_qemuimg_operation(operation)
+                        # fall-back to dd - workaround for bz#1282239
+                        srcSize = srcVol.getVolumeSize(bs=1)
+                        misc.ddWatchCopy(srcVol.getVolumePath(),
+                                         dstVol.getVolumePath(),
+                                         vars.task.aborting,
+                                         size=srcSize)
                 except ActionStopped:
                     raise
                 except se.StorageException:


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3508f0cab1bc841dc8c7277146b2b54ff787f3ef
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