Bug 971312 - block: Mirroring to raw block device doesn't zero out unused blocks
block: Mirroring to raw block device doesn't zero out unused blocks
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: qemu-kvm (Show other bugs)
6.5
Unspecified Unspecified
medium Severity medium
: rc
: ---
Assigned To: Jeff Cody
Virtualization Bugs
:
Depends On: 971297 1136382
Blocks:
  Show dependency treegraph
 
Reported: 2013-06-06 05:16 EDT by juzhang
Modified: 2016-05-10 16:56 EDT (History)
12 users (show)

See Also:
Fixed In Version: qemu-kvm-0.12.1.2-2.489.el6
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 971297
Environment:
Last Closed: 2016-05-10 16:56:44 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Comment 6 Jeff Nelson 2016-02-18 19:11:23 EST
Fix included in qemu-kvm-0.12.1.2-2.489.el6
Comment 8 jingzhao 2016-02-29 22:04:59 EST
Didn't reproduced with kernel-2.6.32-620.el6.x86_64 and qemu-img-rhev-0.12.1.2-2.489.el6.x86_64 

Following is the verified steps:
1.dd if=/dev/urandom of=/home/0223/test.raw bs=1M count=64
2.sudo losetup /dev/loop0 /home/0223/test.raw
3.chmod 666 /dev/loop0
4.Befor mirror,
[root@localhost 0223]# hexdump -n 512 test.raw 
0000000 077c 2b62 a3d0 c821 6044 2165 e3e1 d316
0000010 002b 2bdb 8c1e 8bd7 9bc0 c0d0 79fb d6d1
....................
5.Boot guest with cli:
/usr/libexec/qemu-kvm \
-name rhel6.6.0 \
-machine rhel6.6.0,accel=kvm \
-realtime mlock=off \
-cpu SandyBridge \
-m 4G   \
-smp 4,cores=1,threads=1,sockets=4  \
-uuid 49a3438a-70a3-4ba8-92ce-3a05e0934608 \
-nodefaults \
-rtc base=utc,driftfix=slew \
-monitor unix:/tmp/monitor-unix,server,nowait \
-serial unix:/tmp/serial0,server,nowait \
-global kvm-pit.lost_tick_policy=discard \
-global PIIX4_PM.disable_s3=1 \
-global PIIX4_PM.disable_s4=1 \
-boot order=c,menu=on,strict=on \
-device virtio-scsi-pci,id=scsi \
-drive file=/home/0223/rhel68bk.qcow2,if=none,format=qcow2,id=drive-virtio-scsi,werror=stop,rerror=stop \
-device scsi-hd,drive=drive-virtio-scsi,id=virtio-scsi,bus=scsi.0,scsi-id=0 \
-drive file=/home/0223/target.qcow2,if=none,format=qcow2,id=drive-virtio-scsi1,werror=stop,rerror=stop \
-device scsi-hd,drive=drive-virtio-scsi1,id=virtio-scsi1,bus=scsi.0,scsi-id=1 \
-drive file=/home/0223/test.raw,if=none,id=img \
-device ide-drive,drive=img,id=sys-img \
-netdev tap,id=hostnet0,vhost=on \
-device virtio-net-pci,netdev=hostnet0,id=net0,vectors=0,mac=00:1a:4a:42:0a:00 \
-monitor stdio \
-qmp tcp:0:4466,server,nowait -serial unix:/tmp/ttym,server,nowait \
-vga qxl \
-spice port=5910,password=redhat-vga,disable-ticketing \
-k en-us \

5.Do the mirror with /home/0223/test.raw 
6.After the mirror complete,
[root@localhost 0223]# hexdump -n 512 test.raw 
0000000 077c 2b62 a3d0 c821 6044 2165 e3e1 d316
0000010 002b 2bdb 8c1e 8bd7 9bc0 c0d0 79fb d6d1
0000020 a87c 97b3 7508 8b14 7795 c2e4 a6a1 b048
.....................
Comment 9 jingzhao 2016-03-01 03:50:05 EST
Didn't reproduced the issue and updated the test steps
1. create an empty qcow2 file
# qemu-img create -f qcow2 /tmp/test.qcow2 64M

2. dd a file and association it with a loop device
# dd if=/dev/urandom of=/tmp/test.raw bs=1M count=64
# losetup /dev/loop2 /tmp/test.raw
# chmod 666 /dev/loop2

3. boot guest and do mirror job to the loop device
# /usr/libexec/qemu-kvm \
-drive file=/tmp/test.qcow2,format=qcow2,if=none,id=drive-virtio-blk1,werror=stop,rerror=stop \
-device virtio-blk-pci,drive=drive-virtio-blk1,id=virtio-blk1 \
-monitor stdio
(qemu) __com.redhat_drive-mirror drive-virtio-blk1 /dev/loop2 existing raw
(qemu) __com.redhat_drive-reopen drive-virtio-blk1 /dev/loop2
(qemu) quit 

4. check the loop device
[root@localhost 0223]# hexdump -n 512 /dev/loop2
0000000 0000 0000 0000 0000 0000 0000 0000 0000
*
0000200
Comment 10 jingzhao 2016-03-02 20:49:01 EST
---Updated the comments
1) can reproduced the issue with qemu-kvm-rhev-0.12.1.2-2.488.el6.x86_64
1. create an empty qcow2 file
# qemu-img create -f qcow2 /tmp/test.qcow2 64M

2. dd a file and association it with a loop device
# dd if=/dev/urandom of=/tmp/test.raw bs=1M count=64
# losetup /dev/loop4 /tmp/test.raw
# chmod 666 /dev/loop4

3. boot guest and do mirror job to the loop device
# /usr/libexec/qemu-kvm \
-drive file=/tmp/test.qcow2,format=qcow2,if=none,id=drive-virtio-blk1,werror=stop,rerror=stop \
-device virtio-blk-pci,drive=drive-virtio-blk1,id=virtio-blk1 \
-monitor stdio
(qemu) __com.redhat_drive-mirror drive-virtio-blk1 /dev/loop4 existing raw
(qemu) __com.redhat_drive-reopen drive-virtio-blk1 /dev/loop4
(qemu) quit 

4. check the loop device
[[root@localhost tmp]# hexdump -n 512 /dev/loop4
0000000 3829 5906 1fe6 9f71 2a24 f95b 4a0f 917b
0000010 4f9b aa23 8208 00d1 3c29 f1f0 2e9a 9358
0000020 a23c e9f3 5a5a a3e2 620e dc2a d4f9 ef81
..........

2) Didn't reproduced with qemu-kvm-rhev-0.12.1.2-2.489.el6.x86_64

1. create an empty qcow2 file
# qemu-img create -f qcow2 /tmp/test.qcow2 64M

2. dd a file and association it with a loop device
# dd if=/dev/urandom of=/tmp/test.raw bs=1M count=64
# losetup /dev/loop4 /tmp/test.raw
# chmod 666 /dev/loop4

3. boot guest and do mirror job to the loop device
# /usr/libexec/qemu-kvm \
-drive file=/tmp/test.qcow2,format=qcow2,if=none,id=drive-virtio-blk1,werror=stop,rerror=stop \
-device virtio-blk-pci,drive=drive-virtio-blk1,id=virtio-blk1 \
-monitor stdio
(qemu) __com.redhat_drive-mirror drive-virtio-blk1 /dev/loop4 existing raw
(qemu) __com.redhat_drive-reopen drive-virtio-blk1 /dev/loop4
(qemu) quit

4.check the loop device
[root@localhost tmp]# hexdump -n 512 /dev/loop4
0000000 0000 0000 0000 0000 0000 0000 0000 0000
*
0000200
Comment 12 Guo, Zhiyi 2016-03-22 06:08:23 EDT
Verify on qemu-kvm-rhev-0.12.1.2-2.490.el6.x86_64.rpm:
host:2.6.32-633.el6.x86_64
1. create an empty qcow2 file
# qemu-img create -f qcow2 /tmp/test.qcow2 64M

2. dd a file and association it with a loop device
# dd if=/dev/urandom of=/tmp/test.raw bs=1M count=64
# losetup /dev/loop1 /tmp/test.raw
# chmod 666 /dev/loop1

3. boot guest and do mirror job to the loop device
# /usr/libexec/qemu-kvm \
-drive file=/tmp/test.qcow2,format=qcow2,if=none,id=drive-virtio-blk1,werror=stop,rerror=stop \
-device virtio-blk-pci,drive=drive-virtio-blk1,id=virtio-blk1 \
-monitor stdio
(qemu) __com.redhat_drive-mirror drive-virtio-blk1 /dev/loop1 existing raw
(qemu) __com.redhat_drive-reopen drive-virtio-blk1 /dev/loop1
(qemu) quit

4.check the loop device
[root@localhost tmp]# hexdump -n 512 /dev/loop4
0000000 0000 0000 0000 0000 0000 0000 0000 0000
*
0000200
Comment 14 errata-xmlrpc 2016-05-10 16:56:44 EDT
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-2016-0815.html

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