Hide Forgot
When source image is sparse, we should use sparse write on destination as well. Reproducer: # qemu-img create source.img 1G # qemu-io source.img -c 'write -z 0 1G' # /usr/libexec/qemu-kvm -drive file=source.img,if=none,id=source (QMP) drive-mirror device=source target=target.img sync=full # qemu-img map target.img Actual result: # qemu-img map /var/tmp/b Offset Length Mapped to File 0 0x40000000 0 /var/tmp/b Expected result: # qemu-img map /var/tmp/b Offset Length Mapped to File (no mapping)
reproduced on qemu-kvm-rhev-2.3.0-7.el7.x86_64: [root@hp-dl385g7-04 ~]# rpm -q qemu-kvm-rhev qemu-kvm-rhev-2.3.0-7.el7.x86_64 [root@hp-dl385g7-04 ~]# qemu-img create source.img 1G Formatting 'source.img', fmt=raw size=1073741824 [root@hp-dl385g7-04 ~]# qemu-io source.img -c 'write -z 0 1G' WARNING: Image format was not specified for 'source.img' and probing guessed raw. Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted. Specify the 'raw' format explicitly to remove the restrictions. wrote 1073741824/1073741824 bytes at offset 0 1 GiB, 1 ops; 0.0095 sec (105.020 GiB/sec and 105.0200 ops/sec) [root@hp-dl385g7-04 ~]# /usr/libexec/qemu-kvm -drive file=source.img,if=none,id=source -monitor stdio (qemu) drive_mirror source target.img Formatting 'target.img', fmt=raw size=1073741824 (qemu) info block block block-jobs blockstats (qemu) info block-jobs Type mirror, device source: Completed 1073741824 of 1073741824 bytes, speed limit 0 bytes/s (qemu) blo block_job_cancel block_job_complete block_job_pause block_job_resume block_job_set_speed block_passwd block_resize block_set_io_throttle block_stream (qemu) block_job block_job_cancel block_job_complete block_job_pause block_job_resume block_job_set_speed (qemu) block_job_complete source (qemu) quit [root@hp-dl385g7-04 ~]# qemu-img map target.img Offset Length Mapped to File 0 0x40000000 0 target.img
If testing this with NFS (bug 1079385) note that NFS 4.2 negotation must be enabled explicitly. This test case should be added to the thin-provisioning test plan. Another important test case is to run fstrim during drive-mirror.
Fix included in qemu-kvm-rhev-2.3.0-13.el7
Verified on qemu-kvm-rhev-2.3.0-13.el7.x86_64: with steps in comment 2, after last step: [root@hp-dl385g7-02 ~]# qemu-img map target.img Offset Length Mapped to File
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://rhn.redhat.com/errata/RHBA-2015-2546.html