Yeela Kaplan has uploaded a new change for review.
Change subject: use qemu-img convert to copy sparse volumes when moving a vm ......................................................................
use qemu-img convert to copy sparse volumes when moving a vm
Previously all volumes were copied with dd, with sparse files this would result in the destination volume being fully allocated.
Change-Id: I9eedaa41a64502e548e52c10742335abd05301d8 Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=748386 Signed-off-by: Yeela Kaplan ykaplan@redhat.com --- M vdsm/qemuImg.py M vdsm/storage/image.py 2 files changed, 41 insertions(+), 3 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/79/10979/1
diff --git a/vdsm/qemuImg.py b/vdsm/qemuImg.py index 77befcf..297ad53 100644 --- a/vdsm/qemuImg.py +++ b/vdsm/qemuImg.py @@ -19,10 +19,11 @@ #
import re +from storage import misc from utils import CommandPath, execCmd
_qemuimg = CommandPath("qemu-img", - "/usr/bin/qemu-img", # Fedora, RHEL + "/usr/bin/qemu-img", # Fedora, EL6 )
@@ -98,3 +99,26 @@
if rc != 0: raise QImgError(rc, out, err) + + +def convert(srcVolPath, dstVolPath, stop, srcFmt=None, dstFmt=None): + cmd = [_qemuimg.cmd, "convert", "-t", "none"] + + if srcFmt: + cmd.extend(("-f", srcFmt)) + + cmd.append(srcVolPath) + + if dstFmt: + cmd.extend(("-O", dstFmt)) + + cmd.append(dstVolPath) + + (rc, out, err) = misc.watchCmd(cmd, stop=stop, + nice=misc.NICENESS.LOW, + ioclass=misc.IOCLASS.IDLE) + + if rc != 0: + raise QImgError(rc, out, err) + + return (rc, out, err) diff --git a/vdsm/storage/image.py b/vdsm/storage/image.py index 4364c38..411b234 100644 --- a/vdsm/storage/image.py +++ b/vdsm/storage/image.py @@ -25,6 +25,7 @@ from contextlib import contextmanager
import volume +from vdsm import qemuImg from sdc import sdCache import sd import misc @@ -582,8 +583,21 @@ # Do the actual copy try: dstVol = destDom.produceVolume(imgUUID=imgUUID, volUUID=srcVol.volUUID) - srcSize = srcVol.getVolumeSize(bs=1) - misc.ddWatchCopy(srcVol.getVolumePath(), dstVol.getVolumePath(), vars.task.aborting, size=srcSize) + srcFmt = srcVol.getFormat() + if srcFmt == volume.RAW_FORMAT: + srcFmt = volume.fmt2str(srcFmt) + dstFmt = volume.fmt2str(dstVol.getFormat()) + self.log.debug("start qemu convert") + qemuImg.convert(srcVol.getVolumePath(), + dstVol.getVolumePath(), + vars.task.aborting, + srcFmt, dstFmt) + else: + srcSize = srcVol.getVolumeSize(bs=1) + misc.ddWatchCopy(srcVol.getVolumePath(), + dstVol.getVolumePath(), + vars.task.aborting, + size=srcSize) except se.ActionStopped: raise except se.StorageException:
-- To view, visit http://gerrit.ovirt.org/10979 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange Gerrit-Change-Id: I9eedaa41a64502e548e52c10742335abd05301d8 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Yeela Kaplan ykaplan@redhat.com
oVirt Jenkins CI Server has posted comments on this change.
Change subject: use qemu-img convert to copy sparse volumes when moving a vm ......................................................................
Patch Set 1:
Build Started http://jenkins.ovirt.org/job/vdsm_unit_tests_manual_gerrit/714/ (2/2)
-- To view, visit http://gerrit.ovirt.org/10979 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I9eedaa41a64502e548e52c10742335abd05301d8 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Yeela Kaplan ykaplan@redhat.com Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: use qemu-img convert to copy sparse volumes when moving a vm ......................................................................
Patch Set 1:
Build Started http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/679/ (1/2)
-- To view, visit http://gerrit.ovirt.org/10979 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I9eedaa41a64502e548e52c10742335abd05301d8 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Yeela Kaplan ykaplan@redhat.com Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: use qemu-img convert to copy sparse volumes when moving a vm ......................................................................
Patch Set 1:
Build Successful
http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/679/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_manual_gerrit/714/ : SUCCESS
-- To view, visit http://gerrit.ovirt.org/10979 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I9eedaa41a64502e548e52c10742335abd05301d8 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Yeela Kaplan ykaplan@redhat.com Gerrit-Reviewer: oVirt Jenkins CI Server
Federico Simoncelli has posted comments on this change.
Change subject: use qemu-img convert to copy sparse volumes when moving a vm ......................................................................
Patch Set 1: I would prefer that you didn't submit this
(2 inline comments)
It's a -1 just for minor comments. Next round is a +2 for me.
.................................................... File vdsm/storage/image.py Line 583: # Do the actual copy Line 584: try: Line 585: dstVol = destDom.produceVolume(imgUUID=imgUUID, volUUID=srcVol.volUUID) Line 586: srcFmt = srcVol.getFormat() Line 587: if srcFmt == volume.RAW_FORMAT: Extra space. It doesn't ease the readability. Line 588: srcFmt = volume.fmt2str(srcFmt) Line 589: dstFmt = volume.fmt2str(dstVol.getFormat()) Line 590: self.log.debug("start qemu convert") Line 591: qemuImg.convert(srcVol.getVolumePath(),
Line 584: try: Line 585: dstVol = destDom.produceVolume(imgUUID=imgUUID, volUUID=srcVol.volUUID) Line 586: srcFmt = srcVol.getFormat() Line 587: if srcFmt == volume.RAW_FORMAT: Line 588: srcFmt = volume.fmt2str(srcFmt) I don't like to overwrite variables values. Let's use something different maybe srcFmtStr and dstFmtStr. Line 589: dstFmt = volume.fmt2str(dstVol.getFormat()) Line 590: self.log.debug("start qemu convert") Line 591: qemuImg.convert(srcVol.getVolumePath(), Line 592: dstVol.getVolumePath(),
-- To view, visit http://gerrit.ovirt.org/10979 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I9eedaa41a64502e548e52c10742335abd05301d8 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Yeela Kaplan ykaplan@redhat.com Gerrit-Reviewer: Ayal Baron abaron@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimonce@redhat.com Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: use qemu-img convert to copy sparse volumes when moving a vm ......................................................................
Patch Set 2:
Build Started http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/710/ (2/2)
-- To view, visit http://gerrit.ovirt.org/10979 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I9eedaa41a64502e548e52c10742335abd05301d8 Gerrit-PatchSet: 2 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Yeela Kaplan ykaplan@redhat.com Gerrit-Reviewer: Ayal Baron abaron@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimonce@redhat.com Gerrit-Reviewer: Yeela Kaplan ykaplan@redhat.com Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: use qemu-img convert to copy sparse volumes when moving a vm ......................................................................
Patch Set 2:
Build Started http://jenkins.ovirt.org/job/vdsm_unit_tests_manual_gerrit/745/ (1/2)
-- To view, visit http://gerrit.ovirt.org/10979 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I9eedaa41a64502e548e52c10742335abd05301d8 Gerrit-PatchSet: 2 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Yeela Kaplan ykaplan@redhat.com Gerrit-Reviewer: Ayal Baron abaron@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimonce@redhat.com Gerrit-Reviewer: Yeela Kaplan ykaplan@redhat.com Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: use qemu-img convert to copy sparse volumes when moving a vm ......................................................................
Patch Set 2:
Build Successful
http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/710/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_manual_gerrit/745/ : SUCCESS
-- To view, visit http://gerrit.ovirt.org/10979 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I9eedaa41a64502e548e52c10742335abd05301d8 Gerrit-PatchSet: 2 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Yeela Kaplan ykaplan@redhat.com Gerrit-Reviewer: Ayal Baron abaron@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimonce@redhat.com Gerrit-Reviewer: Yeela Kaplan ykaplan@redhat.com Gerrit-Reviewer: oVirt Jenkins CI Server
Federico Simoncelli has posted comments on this change.
Change subject: use qemu-img convert to copy sparse volumes when moving a vm ......................................................................
Patch Set 2: Looks good to me, approved
-- To view, visit http://gerrit.ovirt.org/10979 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I9eedaa41a64502e548e52c10742335abd05301d8 Gerrit-PatchSet: 2 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Yeela Kaplan ykaplan@redhat.com Gerrit-Reviewer: Ayal Baron abaron@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimonce@redhat.com Gerrit-Reviewer: Yeela Kaplan ykaplan@redhat.com Gerrit-Reviewer: oVirt Jenkins CI Server
Yeela Kaplan has posted comments on this change.
Change subject: use qemu-img convert to copy sparse volumes when moving a vm ......................................................................
Patch Set 2: Verified
Has been verified by dpaikov and myself.
-- To view, visit http://gerrit.ovirt.org/10979 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I9eedaa41a64502e548e52c10742335abd05301d8 Gerrit-PatchSet: 2 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Yeela Kaplan ykaplan@redhat.com Gerrit-Reviewer: Ayal Baron abaron@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimonce@redhat.com Gerrit-Reviewer: Yeela Kaplan ykaplan@redhat.com Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: use qemu-img convert to copy sparse volumes when moving a vm ......................................................................
Patch Set 3:
Build Started http://jenkins.ovirt.org/job/vdsm_unit_tests_manual_gerrit/863/ (1/2)
-- To view, visit http://gerrit.ovirt.org/10979 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I9eedaa41a64502e548e52c10742335abd05301d8 Gerrit-PatchSet: 3 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Yeela Kaplan ykaplan@redhat.com Gerrit-Reviewer: Ayal Baron abaron@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimonce@redhat.com Gerrit-Reviewer: Yeela Kaplan ykaplan@redhat.com Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: use qemu-img convert to copy sparse volumes when moving a vm ......................................................................
Patch Set 3:
Build Started http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/828/ (2/2)
-- To view, visit http://gerrit.ovirt.org/10979 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I9eedaa41a64502e548e52c10742335abd05301d8 Gerrit-PatchSet: 3 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Yeela Kaplan ykaplan@redhat.com Gerrit-Reviewer: Ayal Baron abaron@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimonce@redhat.com Gerrit-Reviewer: Yeela Kaplan ykaplan@redhat.com Gerrit-Reviewer: oVirt Jenkins CI Server
Yeela Kaplan has posted comments on this change.
Change subject: use qemu-img convert to copy sparse volumes when moving a vm ......................................................................
Patch Set 3: Verified
Same verify from previous patch set. Only rebase.
-- To view, visit http://gerrit.ovirt.org/10979 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I9eedaa41a64502e548e52c10742335abd05301d8 Gerrit-PatchSet: 3 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Yeela Kaplan ykaplan@redhat.com Gerrit-Reviewer: Ayal Baron abaron@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimonce@redhat.com Gerrit-Reviewer: Yeela Kaplan ykaplan@redhat.com Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: use qemu-img convert to copy sparse volumes when moving a vm ......................................................................
Patch Set 3: Fails
Build Failed
http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/828/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_manual_gerrit/863/ : FAILURE
-- To view, visit http://gerrit.ovirt.org/10979 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I9eedaa41a64502e548e52c10742335abd05301d8 Gerrit-PatchSet: 3 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Yeela Kaplan ykaplan@redhat.com Gerrit-Reviewer: Ayal Baron abaron@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimonce@redhat.com Gerrit-Reviewer: Yeela Kaplan ykaplan@redhat.com Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: use qemu-img convert to copy sparse volumes when moving a vm ......................................................................
Patch Set 4:
Build Started http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/829/ (2/2)
-- To view, visit http://gerrit.ovirt.org/10979 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I9eedaa41a64502e548e52c10742335abd05301d8 Gerrit-PatchSet: 4 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Yeela Kaplan ykaplan@redhat.com Gerrit-Reviewer: Ayal Baron abaron@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimonce@redhat.com Gerrit-Reviewer: Yeela Kaplan ykaplan@redhat.com Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: use qemu-img convert to copy sparse volumes when moving a vm ......................................................................
Patch Set 4:
Build Started http://jenkins.ovirt.org/job/vdsm_unit_tests_manual_gerrit/864/ (1/2)
-- To view, visit http://gerrit.ovirt.org/10979 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I9eedaa41a64502e548e52c10742335abd05301d8 Gerrit-PatchSet: 4 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Yeela Kaplan ykaplan@redhat.com Gerrit-Reviewer: Ayal Baron abaron@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimonce@redhat.com Gerrit-Reviewer: Yeela Kaplan ykaplan@redhat.com Gerrit-Reviewer: oVirt Jenkins CI Server
Yeela Kaplan has posted comments on this change.
Change subject: use qemu-img convert to copy sparse volumes when moving a vm ......................................................................
Patch Set 4: Verified
Only rebase and change for PEP8. Same verify for patchset2.
-- To view, visit http://gerrit.ovirt.org/10979 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I9eedaa41a64502e548e52c10742335abd05301d8 Gerrit-PatchSet: 4 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Yeela Kaplan ykaplan@redhat.com Gerrit-Reviewer: Ayal Baron abaron@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimonce@redhat.com Gerrit-Reviewer: Yeela Kaplan ykaplan@redhat.com Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: use qemu-img convert to copy sparse volumes when moving a vm ......................................................................
Patch Set 4:
Build Successful
http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/829/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_manual_gerrit/864/ : SUCCESS
-- To view, visit http://gerrit.ovirt.org/10979 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I9eedaa41a64502e548e52c10742335abd05301d8 Gerrit-PatchSet: 4 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Yeela Kaplan ykaplan@redhat.com Gerrit-Reviewer: Ayal Baron abaron@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimonce@redhat.com Gerrit-Reviewer: Yeela Kaplan ykaplan@redhat.com Gerrit-Reviewer: oVirt Jenkins CI Server
Dan Kenigsberg has posted comments on this change.
Change subject: use qemu-img convert to copy sparse volumes when moving a vm ......................................................................
Patch Set 4: Looks good to me, approved
Copying Federico's score.
-- To view, visit http://gerrit.ovirt.org/10979 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I9eedaa41a64502e548e52c10742335abd05301d8 Gerrit-PatchSet: 4 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Yeela Kaplan ykaplan@redhat.com Gerrit-Reviewer: Ayal Baron abaron@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimonce@redhat.com Gerrit-Reviewer: Yeela Kaplan ykaplan@redhat.com Gerrit-Reviewer: oVirt Jenkins CI Server
Dan Kenigsberg has submitted this change and it was merged.
Change subject: use qemu-img convert to copy sparse volumes when moving a vm ......................................................................
use qemu-img convert to copy sparse volumes when moving a vm
Previously all volumes were copied with dd, with sparse files this would result in the destination volume being fully allocated.
Change-Id: I9eedaa41a64502e548e52c10742335abd05301d8 Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=748386 Signed-off-by: Yeela Kaplan ykaplan@redhat.com --- M vdsm/qemuImg.py M vdsm/storage/image.py 2 files changed, 41 insertions(+), 5 deletions(-)
Approvals: Yeela Kaplan: Verified Dan Kenigsberg: Looks good to me, approved
-- To view, visit http://gerrit.ovirt.org/10979 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: merged Gerrit-Change-Id: I9eedaa41a64502e548e52c10742335abd05301d8 Gerrit-PatchSet: 4 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Yeela Kaplan ykaplan@redhat.com Gerrit-Reviewer: Ayal Baron abaron@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimonce@redhat.com Gerrit-Reviewer: Yeela Kaplan ykaplan@redhat.com Gerrit-Reviewer: oVirt Jenkins CI Server
vdsm-patches@lists.fedorahosted.org