Bug 1367731

Summary: Other operations(snapshot/hot-unplug) to the block are not forbidden after image streaming starts, which cause qemu and guest hang until streaming completes.
Product: Red Hat Enterprise Linux 7 Reporter: Qianqian Zhu <qizhu>
Component: qemu-kvm-rhevAssignee: John Snow <jsnow>
Status: CLOSED ERRATA QA Contact: Qianqian Zhu <qizhu>
Severity: urgent Docs Contact:
Priority: high    
Version: 7.3CC: chayang, juzhang, knoel, michen, mrezanin, virt-maint, xfu
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: qemu-kvm-rhev-2.9.0-1.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-01 23:34:44 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:

Description Qianqian Zhu 2016-08-17 10:33:03 UTC
Description of problem:
Other operations(snapshot/hot-unplug) to the block are not forbidden after image streaming starts, which cause qemu and guest hang until streaming completes, although such operation(snapshot/hot-unplug) will be executed when streaming completes.

Version-Release number of selected component (if applicable):
qemu-kvm-rhev-2.6.0-20.el7.x86_64
kernel-3.10.0-491.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.Launch guest with two disks:
 /usr/libexec/qemu-kvm -name linux -cpu SandyBridge -m 2048 -realtime mlock=off -smp 2,sockets=2,cores=1,threads=1 -uuid 7bef3814-631a-48bb-bae8-2b1de75f7a13 -nodefaults -monitor stdio -rtc base=utc,driftfix=slew -global kvm-pit.lost_tick_policy=discard -global PIIX4_PM.disable_s3=1 -global PIIX4_PM.disable_s4=1 -boot order=c,menu=on -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x6 -drive file=/home/RHEL-Server-7.3-64-virtio.qcow2,if=none,cache=none,id=drive-virtio-disk0,format=qcow2 -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x7,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=0 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x8 -msg timestamp=on -spice port=5901,disable-ticketing -vga qxl -global qxl-vga.revision=3 -netdev tap,id=hostnet0,vhost=on -device virtio-net-pci,netdev=hostnet0,id=net0,mac=3C:D9:2B:09:AB:44,bus=pci.0,addr=0x3 -qmp tcp::5555,server,nowait -drive file=/home/datedisk.qcow2,if=none,cache=none,id=drive-virtio-disk1,format=qcow2 -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x5,drive=drive-virtio-disk1,id=virtio-disk1,bootindex=1

2.Snapshot for the none-system disk.
{ "execute": "blockdev-snapshot-sync", "arguments": { "device": "drive-virtio-disk1","snapshot-file": "/home/sn1", "format": "qcow2", "mode": "absolute-paths" } }

3.Block stream:
{ "execute": "block-stream", "arguments": { "device": "drive-virtio-disk1", "speed":1000000000, "on-error": "report"}}

4.Snapshot/Hot-unplug the disk right after block stream.
{ "execute": "blockdev-snapshot-sync", "arguments": { "device": "drive-virtio-disk1","snapshot-file": "/home/sn2", "format": "qcow2", "mode": "absolute-paths" } }
Or: {"execute":"device_del","arguments":{"id":"virtio-disk1"}}

Actual results:
Both qemu and guest hang during streaming.

Expected results:
Such operation should be forbidden, or it will be fluently executed one by one. There should not exit any hang.

Additional info:

Comment 2 Qianqian Zhu 2017-05-05 09:27:07 UTC
Test on qemu-kvm-rhev-2.9.0-2.el7.x86_64, This issue is gone.

Result:
Snapshot is forbidden when streaming not finished.
{ "execute": "blockdev-snapshot-sync", "arguments": { "device": "drive-virtio-blk0","snapshot-file": "/home/sn2", "format": "qcow2", "mode": "absolute-paths" } }
{"error": {"class": "GenericError", "desc": "Node 'drive-virtio-blk0' is busy: block device is in use by block job: stream"}}
And job will be cancelled if hot unplug device in use:
{"execute":"device_del","arguments":{"id":"virtio-blk-0"}}
{"return": {}}
{"timestamp": {"seconds": 1493976284, "microseconds": 98220}, "event": "DEVICE_DELETED", "data": {"path": "/machine/peripheral/virtio-blk-0/virtio-backend"}}
{"timestamp": {"seconds": 1493976284, "microseconds": 98314}, "event": "DEVICE_DELETED", "data": {"device": "virtio-blk-0", "path": "/machine/peripheral/virtio-blk-0"}}
{"timestamp": {"seconds": 1493976284, "microseconds": 121775}, "event": "BLOCK_JOB_CANCELLED", "data": {"device": "drive-virtio-blk0", "len": 21474836480, "offset": 3551920128, "speed": 1000000000, "type": "stream"}}

Comment 3 John Snow 2017-05-05 16:34:23 UTC
Thanks for updating the BZ, this was first on my list for today -- what a pleasant surprise!

Thank you very much.

Mirek, marking as post to indicate this was fixed via the 2.9.0 rebase.

Comment 5 Qianqian Zhu 2017-05-17 01:53:41 UTC
Per comment 2, moving to VERIFIED.

Comment 7 errata-xmlrpc 2017-08-01 23:34:44 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://access.redhat.com/errata/RHSA-2017:2392

Comment 8 errata-xmlrpc 2017-08-02 01:12:22 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://access.redhat.com/errata/RHSA-2017:2392

Comment 9 errata-xmlrpc 2017-08-02 02:04:21 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://access.redhat.com/errata/RHSA-2017:2392

Comment 10 errata-xmlrpc 2017-08-02 02:45:08 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://access.redhat.com/errata/RHSA-2017:2392

Comment 11 errata-xmlrpc 2017-08-02 03:09: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.

https://access.redhat.com/errata/RHSA-2017:2392

Comment 12 errata-xmlrpc 2017-08-02 03:29:59 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://access.redhat.com/errata/RHSA-2017:2392