Bug 807898

Summary: guest quit or device hot-unplug during streaming fails
Product: Red Hat Enterprise Linux 6 Reporter: Shaolong Hu <shu>
Component: qemu-kvmAssignee: Paolo Bonzini <pbonzini>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.3CC: acathrow, bsarathy, dyasny, juzhang, michen, minovotn, mkenneth, pbonzini, tburke, virt-maint, wdai
Target Milestone: rcKeywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qemu-kvm-0.12.1.2-2.274.el6 Doc Type: Bug Fix
Doc Text:
No documentation needed.
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-06-20 11:45:45 UTC Type: ---
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:    
Bug Blocks: 806280    
Attachments:
Description Flags
guest screenshot after s4
none
patch to fix the bug, RHEL version none

Description Shaolong Hu 2012-03-29 05:21:10 UTC
Created attachment 573530 [details]
guest screenshot after s4

Description of problem:
------------------------
guest s4 + streaming fails


Version-Release number of selected component (if applicable):
-------------------------------------------------------------
qemu-kvm 267rhev
guest kernel 258


How reproducible:
------------------
2/2

Steps to Reproduce:
--------------------
1./usr/libexec/qemu-kvm -enable-kvm -M rhel6.3.0 -m 4G -name rhel6.3-64 -rtc base=utc,clock=host,driftfix=slew -no-kvm-pit-reinjection -uuid 3f2ea5cd-3d29-48ff-aab2-23df1b6ae213 -drive file=/root/RHEL-Server-6.3-64-virtio.qcow2,cache=none,if=none,rerror=stop,werror=stop,id=drive-virtio-disk0,format=qcow2 -device virtio-blk-pci,drive=drive-virtio-disk0,id=device-virtio-disk0 -netdev tap,script=/etc/qemu-ifup,id=netdev0 -device virtio-net-pci,netdev=netdev0,id=device-net0 -boot order=cd -monitor stdio -usb -device usb-tablet,id=input0 -chardev socket,id=s1,path=/tmp/s1,server,nowait -device isa-serial,chardev=s1 -vnc :10 -monitor tcp::1234,server,nowait -smp 4 -qmp tcp:0:5555,server,nowait -chardev socket,id=qmp_monitor_id_qmpmonitor1,path=/tmp/qmp,server,nowait -mon chardev=qmp_monitor_id_qmpmonitor1,mode=control

2.in qemu monitor:
(qemu) snapshot_blkdev drive-virtio-disk0 /root/sn1 qcow2

3.in qemu monitor:
(qemu) block_stream drive-virtio-disk0

4.in guest, s4:
echo disk > /sys/power/state

  
Actual results:
----------------
s4 fails to end, guest hang, screenshot in attachment, boot guest with sn1, guest boots as normal instead of resuming from s4.


Additional info:
-----------------
find this problem with bug 807894, maybe the same one.

Comment 2 Dor Laor 2012-03-29 07:17:53 UTC
Does s4 work 100% reliable w/o streaming? Same question to streaming w/o s4
Let's close it as a duplicate of # 807894 for the time being

*** This bug has been marked as a duplicate of bug 807894 ***

Comment 3 Shaolong Hu 2012-03-29 07:23:23 UTC
(In reply to comment #2)
> Does s4 work 100% reliable w/o streaming? Same question to streaming w/o s4
> Let's close it as a duplicate of # 807894 for the time being
> 
> *** This bug has been marked as a duplicate of bug 807894 ***

Yes, s4 w/o streaming works fine(try 2 times, not sure 100% works), after s4, qemu-kvm quits, start qemu-kvm again, guest resumes from s4 correctly.

Comment 4 Paolo Bonzini 2012-03-29 14:17:12 UTC
This is related to shutdown while streaming (bug 807894 comment 9).

The following works:

1) start qemu-kvm with -no-shutdown
2) snapshot_blkdev virtio0 /home/pbonzini/snap.qcow2 qcow2
3) block_stream virtio0
4) ... echo disk > /sys/power/state

when it finishes:
5) block_job_cancel virtio0
6) quit
7) reboot with snap.qcow2

Comment 5 Paolo Bonzini 2012-03-29 15:48:19 UTC
This happens if streaming does an iteration while qcow2_cache_flush runs.  It can be fixed by adding a proper qemu_aio_wait.  Submitting patch upstream for comments.

Comment 6 Paolo Bonzini 2012-03-29 15:57:45 UTC
Created attachment 573721 [details]
patch to fix the bug, RHEL version

Comment 7 Paolo Bonzini 2012-03-30 07:52:07 UTC
device_del also needs to be tested.

Comment 8 Shaolong Hu 2012-03-30 08:04:52 UTC
(In reply to comment #7)
> device_del also needs to be tested.

sure, we have a case covering it.

Comment 9 Paolo Bonzini 2012-04-03 14:33:50 UTC
*** Bug 808004 has been marked as a duplicate of this bug. ***

Comment 12 daiwei 2012-04-19 12:36:00 UTC
Reproduced this issue with steps and environment as follows:

# uname -r; rpm -q qemu-kvm
2.6.32-262.el6.x86_64
qemu-kvm-0.12.1.2-2.267.el6ev.x86_64

1.boot guest 

2.in qemu monitor:
(qemu) snapshot_blkdev drive-virtio-disk0 /root/sn1 qcow2

s4 fails to end, guest hangs.boot guest with sn1,guest boots as normal instead of resuming from s4.

Verified this issue with steps and environment as follows:

# uname -r ;rpm -q qemu-kvm-rhev
2.6.32-262.el6.x86_64
qemu-kvm-rhev-0.12.1.2-2.278.el6.x86_64

1. boot guest

2.in qemu monitor:
(qemu) snapshot_blkdev drive-virtio-disk0 /root/sn1 qcow2

qemu-kvm quit normally. boot guest with sn1,guest resumes from s4 .

3.boot guest with a datadisk 
/usr/libexec/qemu-kvm -enable-kvm -M rhel6.3.0 -m 4G -name rhel6.3-64 -rtc base=utc,clock=host,driftfix=slew -no-kvm-pit-reinjection -uuid 3f2ea5cd-3d29-48ff-aab2-23df1b6ae213 -drive file=/home/rhel6.3-64.qcow2,cache=none,if=none,rerror=stop,werror=stop,id=drive-virtio-disk0,format=qcow2 -device virtio-blk-pci,drive=drive-virtio-disk0,id=device-virtio-disk0 -netdev tap,script=/etc/qemu-ifup-switch,id=netdev0 -device virtio-net-pci,netdev=netdev0,id=device-net0 -boot order=cd -monitor stdio -usb -device usb-tablet,id=input0 -chardev socket,id=s1,path=/tmp/s1,server,nowait -device isa-serial,chardev=s1 -vnc :10 -monitor tcp::1234,server,nowait -smp 4 -qmp tcp:0:5555,server,nowait -chardev socket,id=qmp_monitor_id_qmpmonitor1,path=/tmp/qmp,server,nowait -mon chardev=qmp_monitor_id_qmpmonitor1,mode=control -drive file=/home/datadisk.qcow2,cache=none,if=none,rerror=stop,werror=stop,id=disk1,format=qcow2 -device virtio-blk-pci,drive=disk1,id=datadisk1

4.in qemu monitor:
(qemu) snapshot_blkdev disk1 /root/sn2 qcow2
(qemu) block-stream disk1
(qemu) device_del datadisk1

block-job was canceled , and boot guest with sn2 works well.

So, this bug has been fixed.

Comment 15 Michal Novotny 2012-05-04 13:16:36 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:
NEEDINFO

Comment 16 Paolo Bonzini 2012-05-04 13:44:47 UTC
New feature in 6.3, no documentation needed.

Comment 17 Paolo Bonzini 2012-05-04 13:44:47 UTC
    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -1 +1 @@
-NEEDINFO+No documentation needed.

Comment 18 errata-xmlrpc 2012-06-20 11:45:45 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