Bug 1242316 - Add "unmap" support for drive-mirror
Summary: Add "unmap" support for drive-mirror
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm-rhev
Version: 7.2
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Fam Zheng
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks: 1232914 1297255
TreeView+ depends on / blocked
 
Reported: 2015-07-13 02:54 UTC by Fam Zheng
Modified: 2016-01-11 01:39 UTC (History)
6 users (show)

Fixed In Version: qemu-kvm-rhev-2.3.0-13.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-12-04 16:49:33 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:2546 normal SHIPPED_LIVE qemu-kvm-rhev bug fix and enhancement update 2015-12-04 21:11:56 UTC

Description Fam Zheng 2015-07-13 02:54:39 UTC
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)

Comment 2 Shaolong Hu 2015-07-15 02:26:05 UTC
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

Comment 3 Paolo Bonzini 2015-07-17 11:27:10 UTC
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.

Comment 4 Miroslav Rezanina 2015-07-24 11:09:00 UTC
Fix included in qemu-kvm-rhev-2.3.0-13.el7

Comment 6 Shaolong Hu 2015-07-29 08:22:07 UTC
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

Comment 8 errata-xmlrpc 2015-12-04 16:49:33 UTC
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


Note You need to log in before you can comment on or make changes to this bug.