Bug 844627

Summary: copy cluster-sized blocks to the target of live storage migration
Product: Red Hat Enterprise Linux 6 Reporter: Paolo Bonzini <pbonzini>
Component: qemu-kvmAssignee: Paolo Bonzini <pbonzini>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: urgent Docs Contact:
Priority: urgent    
Version: 6.3CC: abaron, acathrow, bsarathy, chetan, cpelland, dallan, dyasny, iheim, juzhang, mkenneth, pbonzini, qzhang, shuang, shu, tburke, virt-maint, wdai
Target Milestone: rcKeywords: ZStream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: storage
Fixed In Version: qemu-kvm-0.12.1.2-2.326.el6 Doc Type: Bug Fix
Doc Text:
The allocation granularity in a mirroring target was independent of its cluster size, so the target was always bigger than the source. Now, cluster-sized blocks are copied to the target, so the mirroring target and source sizes are identical.
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-02-21 13:07:50 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: 814102, 861905, 864962    
Bug Blocks: 804161, 852458, 858775    

Description Paolo Bonzini 2012-07-31 08:55:44 UTC
Description of problem:
Right now, the allocation granularity in the target is 1M independent of the actual cluster size.  This means that the source and target will grow differently, which makes it harder for RHEV to provision the target correctly.

Version-Release number of selected component (if applicable):


How reproducible:
100%

Steps to Reproduce:
1. Start a guest.
2. Create a snapshot to file X.
3. Start mirroring to file Y.
4. Shut down the guest.
 
Actual results:
Y (mirroring target) is bigger than X (mirroring source).

Expected results:
Y (mirroring target) is always the same size as X (mirroring source).

Comment 1 Paolo Bonzini 2012-08-20 11:58:59 UTC
*** Bug 848665 has been marked as a duplicate of this bug. ***

Comment 6 Dave Allan 2012-09-25 14:38:24 UTC
I talked to Eric Blake, and his changes for bug 856247 cover the libvirt side.

Comment 10 juzhang 2012-10-19 09:32:20 UTC
Reproduced on qemu-kvm-0.12.1.2-2.295.el6_3.2.

Steps
1. boot guest
#/usr/libexec/qemu-kvm -m 8G -smp 8,cores=8,sockets=1,threads=1 -cpu SandyBridge -drive file=/root/RHEL-Server-6.4-64-virtio.qcow2,format=qcow2,if=none,id=drive-virtio-disk0,cache=none,werror=stop,rerror=stop -device virtio-blk-pci,drive=drive-virtio-disk0,id=virtio-blk-pci0,bootindex=1 -netdev tap,sndbuf=0,id=hostnet0,script=/etc/qemu-ifup,downscript=no,vhost=on -device virtio-net-pci,netdev=hostnet0,mac=00:10:1a:61:72:01,bus=pci.0,addr=0x4,id=virtio-net-pci0 -uuid 7678e130-f1a7-4157-875a-8defcdb27af7 -rtc base=localtime,clock=host,driftfix=slew  -vnc :1 -M rhel6.3.0 -monitor stdio -qmp tcp:0:4444,server,nowait

2. Do live snap shot
{ "execute": "transaction", "arguments": {'actions': [ { 'type': 'blockdev-snapshot-sync', 'data' : { 'device': 'drive-virtio-disk0', 'snapshot-file': '/root/blockcopy/sn1' } }] } }

3. do mirror
{ "execute" : "__com.redhat_drive-mirror", "arguments" : { "device" : "drive-virtio-disk0", "target" : "/root/blockcopy/sn2", "format": "qcow2", "mode": "absolute-paths"} }

4. shut down guest

Results:
sn2(mirroring target) > sn1(mirroring source)
#ls -sh
16M sn1   81M sn2

Verify on qemu-kvm-rhev-0.12.1.2-2.295.el6_3.4.x86_64.

Steps
1. boot guest
#/usr/libexec/qemu-kvm -m 8G -smp 8,cores=8,sockets=1,threads=1 -cpu SandyBridge -drive file=/root/RHEL-Server-6.4-64-virtio.qcow2,format=qcow2,if=none,id=drive-virtio-disk0,cache=none,werror=stop,rerror=stop -device virtio-blk-pci,drive=drive-virtio-disk0,id=virtio-blk-pci0,bootindex=1 -netdev tap,sndbuf=0,id=hostnet0,script=/etc/qemu-ifup,downscript=no,vhost=on -device virtio-net-pci,netdev=hostnet0,mac=00:10:1a:61:72:01,bus=pci.0,addr=0x4,id=virtio-net-pci0 -uuid 7678e130-f1a7-4157-875a-8defcdb27af7 -rtc base=localtime,clock=host,driftfix=slew  -vnc :1 -M rhel6.3.0 -monitor stdio -qmp tcp:0:4444,server,nowait

2. Do live snap shot
{ "execute": "transaction", "arguments": {'actions': [ { 'type': 'blockdev-snapshot-sync', 'data' : { 'device': 'drive-virtio-disk0', 'snapshot-file': '/root/blockcopy/sn3' } }] } }

3. do mirror
{ "execute" : "__com.redhat_drive-mirror", "arguments" : { "device" : "drive-virtio-disk0", "target" : "/root/blockcopy/sn4", "format": "qcow2", "mode": "absolute-paths"} }

4. shut down guest

Results:

sn2(mirroring target) = sn1(mirroring source)
#ls -sh
9.9M sn3  9.9M sn4

Comment 11 juzhang 2012-10-19 09:35:02 UTC
Please ignore the comment10, the comment10 is intended to verify rhel6.3.z(Bug 852458 - copy cluster-sized blocks to the target of live storage migration ) bug.

Comment 12 Qunfang Zhang 2012-11-08 05:26:40 UTC
Reproduced on qemu-kvm-rhev-0.12.1.2-2.295.el6.x86_64 and verified pass on qemu-kvm-rhev-0.12.1.2-2.334.el6.x86_64.

Steps:
1. Boot a guest
# /usr/libexec/qemu-kvm -M rhel6.3.0 -cpu SandyBridge  -enable-kvm -m 2048 -smp 2,sockets=2,cores=1,threads=1 -enable-kvm -name rhel6.3 -uuid b7eaee47-7a28-4551-9ec5-09c0569f788b -k en-us -rtc base=localtime,clock=host,driftfix=slew -no-kvm-pit-reinjection -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 -device usb-tablet,id=input0 -drive file=/home/rhel6.3-virtio.qcow2,if=none,id=disk0,format=qcow2,werror=stop,rerror=stop,aio=native -device virtio-blk-pci,id=bus1,drive=disk0,bus=pci.0,addr=0x3  -drive if=none,media=cdrom,id=drive-ide0-1-0,readonly=on,format=raw -device virtio-scsi-pci,id=bus2,bus=pci.0,addr=0x4 -device scsi-cd,bus=bus2.0,drive=drive-ide0-1-0,id=virtio-scsi-pci1 -netdev tap,id=hostnet0,vhost=on -device virtio-net-pci,netdev=hostnet0,id=net0,mac=00:1A:2A:4A:25:85,bus=pci.0,addr=0x5 -monitor stdio -qmp tcp:0:6666,server,nowait -chardev socket,path=/tmp/isa-serial,server,nowait,id=isa1 -device isa-serial,chardev=isa1,id=isa-serial1 -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x8 -chardev socket,id=charchannel0,path=/tmp/serial-socket,server,nowait -device virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=com.redhat.rhevm.vdsm -chardev socket,path=/tmp/foo,server,nowait,id=foo -device virtconsole,chardev=foo,id=console0 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x9 -vnc :10 -k en-us -boot c

2. Create snapshot sn1
blockdev-snapshot-sync disk0 /home/sn1
(qemu) info block
disk0: removable=0 io-status=ok file=/home/sn1 backing_file=/home/rhel6.3-virtio.qcow2 ro=0 drv=qcow2 encrypted=0

3. Mirroring sn1 to mirror.qcow2 file
(qemu) __com.redhat_drive-mirror disk0 /home/mirror.qcow2 qcow2

4. Shutdown guest after mirroring finished.

5. Check the 'sn1' and 'mirror.qcow2' file.

========================
On the old version qemu-kvm-rhev-0.12.1.2-2.295.el6.x86_64:
]# ls -lrth sn1 mirror.qcow2 
-rw-r--r--. 1 root root 11M Nov  8 13:19 sn1
-rw-r--r--. 1 root root 55M Nov  8 13:19 mirror.qcow2

On the fixed version qemu-kvm-rhev-0.12.1.2-2.334.el6.x86_64:

#  ls -lrth sn1 mirror.qcow2 
-rw-r--r--. 1 root root 8.9M Nov  8 13:21 sn1
-rw-r--r--. 1 root root 8.9M Nov  8 13:21 mirror.qcow2

Based on above, this issue is fixed.

Comment 15 errata-xmlrpc 2013-02-21 13:07:50 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.

http://rhn.redhat.com/errata/RHBA-2013-0543.html