Bug 817700
Summary: | virsh migrate --copy-storage-all fails to preserve sparse disk image | |||
---|---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | purpleidea | |
Component: | qemu | Assignee: | Fedora Virtualization Maintainers <virt-maint> | |
Status: | CLOSED DUPLICATE | QA Contact: | Fedora Extras Quality Assurance <extras-qa> | |
Severity: | medium | Docs Contact: | ||
Priority: | unspecified | |||
Version: | 22 | CC: | amit.shah, aoeuser, berrange, bryce.pier, cfergeau, charlie, crobinso, dmsimard, dwmw2, dyuan, famz, grube, itamar, jcody, kwolf, madko, mkalinin, mprivozn, pbonzini, purpleidea, rbalakri, rjones, scottt.tw, shyu, stefanha, virt-maint, zpeng | |
Target Milestone: | --- | |||
Target Release: | --- | |||
Hardware: | x86_64 | |||
OS: | Linux | |||
Whiteboard: | ||||
Fixed In Version: | Doc Type: | Bug Fix | ||
Doc Text: | Story Points: | --- | ||
Clone Of: | ||||
: | 1219541 (view as bug list) | Environment: | ||
Last Closed: | 2016-05-02 20:41:41 UTC | Type: | Bug | |
Regression: | --- | Mount Type: | --- | |
Documentation: | --- | CRM: | ||
Verified Versions: | Category: | --- | ||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | ||
Cloudforms Team: | --- | Target Upstream Version: | ||
Embargoed: | ||||
Bug Depends On: | ||||
Bug Blocks: | 1219541 |
Description
purpleidea
2012-04-30 23:13:10 UTC
Another work-around is to use rsync rather than --copy-storage-all. The following example assumes - a single qcow2 file in the default pool - ssh transport #!/bin/bash VM=$1 TARGET=$2 vm_path=/var/lib/libvirt/images/$VM.img rsync -S --progress $vm_path root@$TARGET:$vm_path && \ virsh migrate --live --suspend --verbose $VM qemu+ssh://$TARGET/system && \ rsync -S --progress $vm_image root@$TARGET:$vm_path && \ virsh -c qemu+ssh://$TARGET/system resume $VM # end script Results in a slightly longer suspended period, but saves disk space. The same ballooning of sparse images occurs when sparse qcow2 images are used as well. This issue is still under investigation. Patch proposed upstream: https://www.redhat.com/archives/libvir-list/2015-April/msg00130.html During review it was pointed out that this can hardly be a libvirt issue since user pre-creates the storage himself. I suspect qemu does not preserve sparse files during storage migration. Switching over to qemu then. I think the issue is that drive-mirror (on the source) and run-time NBD server (on the destination) don't have anything like the has_zero_init logic that qemu-img convert uses to preserve sparseness. The legacy block migration (migrate -b) feature preserved sparseness. It checked for zeroes on the source host and sent a special flag to the destination host instead of the full zero data. This is workaround, to quickly migrate an live VM with sparsed qcow2 file at destination (btw, tar -S copies it very fast) #!/bin/bash VM=$1 TARGET=$2 STOR="/home/guest_images/" cd $STOR virsh snapshot-create-as $VM mig --disk-only --atomic virsh snapshot-delete $VM mig --metadata tar --totals --checkpoint=.8192 -Scvf - $VM.qcow2 | ssh $TARGET "tar -C $STOR -xf -" virsh suspend $VM tar --totals -Scvf - $VM.mig | ssh $TARGET "tar -C $STOR -xf -" virsh migrate --live --undefinesource --persistent --verbose $VM qemu+ssh://$TARGET/system virsh -c qemu+ssh://$TARGET/system blockcommit $VM vda --active --pivot --verbose virsh -c qemu+ssh://$TARGET/system resume $VM ssh $TARGET "cd $STOR; rm -f $VM.mig" Since this is essentially a feature request, tracking this bug in the fedora tracker isn't going accomplish much. There's already a RHEL bug[1] and an upstream qemu[2] bug, that should be sufficient [1]: https://bugzilla.redhat.com/show_bug.cgi?id=1219541 [2]: https://bugs.launchpad.net/qemu/+bug/1449687 *** This bug has been marked as a duplicate of bug 1219541 *** |