Bug 813862

Summary: post-snap1 fixups to live block copy aka mirroring
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: medium Docs Contact:
Priority: high    
Version: 6.3CC: acathrow, areis, bsarathy, dyasny, eblake, juzhang, michen, mkenneth, pbonzini, shu, sluo, syeghiay, tburke, virt-maint
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qemu-kvm-0.12.1.2-2.291.el6 Doc Type: Bug Fix
Doc Text:
No Documentation Needed
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-06-20 11:46:56 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: 813810    
Bug Blocks: 802284, 806280    

Description Paolo Bonzini 2012-04-18 15:36:34 UTC
The following fixes were requested during review of the block mirroring patches:

- drive-mirror:

     documentation fixes
     use current image format as the default when no format is specified

- qmp_transaction:

     remove duplicate check

- bdrv_append:

     add assertion that dirty_bitmap is NULL

- drive-reopen:

     documentation fixes
     refuse to reopen unless the job completes successfully

- block/mirror.c:

     simple optimization, do not set sector_num = -1 inside the loop

Comment 3 Shaolong Hu 2012-05-03 03:50:55 UTC
- drive-mirror:

     documentation fixes
     use current image format as the default when no format is specified


Verify this on qemu-kvm-rhev-0.12.1.2-2.288.el6.x86_64:

1.qemu-img create -f raw sn1 30G

2.{ "execute" : "__com.redhat_drive-mirror", "arguments" : { "device" : "drive-virtio-disk0", "target" : "/root/sn1", "mode": "existing", "full" : false } }

3.{ "execute": "__com.redhat_drive-reopen", "arguments": {"device": "drive-virtio-disk0", "new-image-file": "/root/sn1" } }

4.reboot guest, guest works correctly

Comment 4 Shaolong Hu 2012-05-03 04:39:05 UTC
- drive-reopen:

     documentation fixes
     refuse to reopen unless the job completes successfully

Verify this on qemu-kvm-rhev-0.12.1.2-2.288.el6.x86_64:

1.{ "execute": "__com.redhat_drive-reopen", "arguments": {"device": "drive-virtio-disk0", "new-image-file": "/root/sn1" } }
{"timestamp": {"seconds": 1336019686, "microseconds": 858254}, "event": "BLOCK_JOB_CANCELLED", "data": {"device": "drive-virtio-disk0", "len": 32212254720, "offset": 24367857664, "speed": 0, "type": "mirror"}}
{"error": {"class": "DeviceInUse", "desc": "Device 'drive-virtio-disk0' is in use", "data": {"device": "drive-virtio-disk0"}}}

2.
(qemu) info block-jobs
No active jobs
(qemu) info block
drive-virtio-disk0: removable=0 io-status=ok file=/root/sn1 ro=0 drv=raw encrypted=0


This one failed.

Comment 5 Shaolong Hu 2012-05-03 05:38:14 UTC
- qmp_transaction:

     remove duplicate check

Verify this on qemu-kvm-rhev-0.12.1.2-2.288.el6.x86_64:



1.start guest with base:

{ "execute": "transaction",
     "arguments": { "actions": [
         { 'type': 'blockdev-snapshot-sync', 'data' : { "device": "drive-virtio-disk0",
                                         "snapshot-file": "/root/sn1",
                                         "format": "qcow2" } },
         { 'type': '__com.redhat_drive-mirror', 'data' : { "device": "drive-virtio-disk0",
                                         "target": "/root/sn2",
                                         "mode": "absolute-paths",
                                         "format": "qcow2",
                                         "full": false } } ] } }

2. in step 1, i specify "full"=false, but after step 1, base is copied to sn2

3. 
[root@shu ~]# qemu-img info sn1
image: sn1
file format: qcow2
virtual size: 30G (32212254720 bytes)
disk size: 31M
cluster_size: 65536
backing file: win7-64-virtio.qcow2 (actual path: win7-64-virtio.qcow2)

[root@shu ~]# qemu-img info sn2
image: sn2
file format: qcow2
virtual size: 30G (32212254720 bytes)
disk size: 7.6G
cluster_size: 65536

[root@shu ~]# qemu-img info win7-64-virtio.qcow2 
image: win7-64-virtio.qcow2
file format: qcow2
virtual size: 30G (32212254720 bytes)
disk size: 7.4G
cluster_size: 65536

here win7-64-virtio.qcow2 is the base.


This one failed.

Comment 6 Shaolong Hu 2012-05-03 05:46:13 UTC
- bdrv_append:

     add assertion that dirty_bitmap is NULL

- block/mirror.c:

     simple optimization, do not set sector_num = -1 inside the loop


These two, test run of mirroring with qemu-kvm-rhev-0.12.1.2-2.288.el6.x86_64, no problem found so far, deem as passed.


And according to comment 4 and comment 5, re-assign this bug.

Comment 7 Shaolong Hu 2012-05-03 06:05:10 UTC
Forgot to say, steps in comment 4 is reopening the target when have not reached steady state.

Comment 8 Shaolong Hu 2012-05-03 06:35:35 UTC
Test with qemu-kvm-rhev 282, problem in comment 5 also exists, so it's a separated issue, open new one to track it:

Bug 818449 - mirroring in QMP transaction with "full"=false is treated as "full"=true

Comment 9 Ademar Reis 2012-05-03 14:51:19 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
No Documentation Needed

Comment 14 Shaolong Hu 2012-05-11 03:00:47 UTC
Test with steps in comment 4 on qemu-kvm-rhev-0.12.1.2-2.292.el6.x86_64:

{ "execute" : "__com.redhat_drive-mirror", "arguments" : { "device" : "drive-virtio-disk0", "target" : "/root/nfs/sn3", "format": "qcow2", "mode": "absolute-paths", "full" : true } }
{"return": {}}
{ "execute": "__com.redhat_drive-reopen", "arguments": {"device": "drive-virtio-disk0", "new-image-file": "/root/nfs/sn3", "format": "qcow2" } }
{"timestamp": {"seconds": 1336733701, "microseconds": 136915}, "event": "BLOCK_JOB_CANCELLED", "data": {"device": "drive-virtio-disk0", "len": 21474836480, "offset": 17934843904, "speed": 0, "type": "mirror"}}
{"error": {"class": "DeviceInUse", "desc": "Device 'drive-virtio-disk0' is in use", "data": {"device": "drive-virtio-disk0"}}}

(qemu) info block
drive-virtio-disk0: removable=0 io-status=ok file=/root/nfs/sn2 backing_file=/root/nfs/sn1 ro=0 drv=qcow2 encrypted=0

Job cancelled, and info block shows correct dependency, fixed.

Comment 16 errata-xmlrpc 2012-06-20 11:46:56 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-2012-0746.html