Bug 800274

Summary: hot-plug virtio-scsi controller will aborted after hot-unplug it
Product: Red Hat Enterprise Linux 6 Reporter: Sibiao Luo <sluo>
Component: qemu-kvmAssignee: Paolo Bonzini <pbonzini>
Status: CLOSED DUPLICATE QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: high    
Version: 6.3CC: acathrow, bcao, bsarathy, chayang, flang, juzhang, michen, mkenneth, pbonzini, qzhang, shu, sluo, virt-maint, wdai, wquan, xfu, xigao
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-03-28 06:50:41 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 769712, 857935, 889075    

Description Sibiao Luo 2012-03-06 08:07:58 UTC
Description of problem:
boot a guest with virtio-scsi CD-ROM normally, after that hot-unplug the virtio-scsi controller, and then hot-plug a virtio-scsi controller and virtio-cd, and the aborted occurs. I do not know whether we support this hot-plug currently, but i think it is worthy to fix this issue.

Version-Release number of selected component (if applicable):
host info:
# uname -r & rpm -q qemu-kvm
2.6.32-246.el6.x86_64
qemu-kvm-0.12.1.2-2.236.el6.x86_64
# rpm -q seabios
seabios-0.6.1.2-8.el6.scsitest.x86_64
guest info:
# uname -r
2.6.32-246.el6.x86_64

How reproducible:
100%

Steps to Reproduce:
1. boot a guest with virtio-scsi CD-ROM normally.
CLI:# /usr/libexec/qemu-kvm -enable-kvm -M rhel6.3.0 -smp 2 -m 2G -usb -device usb-tablet,id=input0 -name RHEL-Server-6.3-64 -uuid 9ff50ce8-5831-4556-b43f-84e9d5145e0b -drive file=/home/RHEL6.3_20120304.n.0_x86_64.qcow2,if=none,id=hd,format=qcow2,cache=none,werror=stop,rerror=stop -device virtio-scsi-pci,id=scsi0 -device scsi-disk,drive=hd,scsi-id=0,lun=0,id=scsi_image,bootindex=1 -netdev tap,script=/etc/qemu-ifup,id=netdev0 -device virtio-net-pci,netdev=netdev0,id=device-net0 -spice port=5910,disable-ticketing -vga qxl -monitor stdio -drive file=/home/RHEL6.0-20100922.1-Server-x86_64-DVD1.iso,if=none,id=cd -device virtio-scsi-pci,id=scsi1 -device scsi-cd,drive=cd,id=scsi_cd
2. check the block in qemu monitor.
(qemu) info block
hd: removable=0 io-status=ok file=/home/RHEL6.3_20120304.n.0_x86_64.qcow2 ro=0 drv=qcow2 encrypted=0
cd: removable=1 locked=0 tray-open=0 io-status=ok file=/home/RHEL6.0-20100922.1-Server-x86_64-DVD1.iso ro=0 drv=raw encrypted=0
3. hot-unplug the virtio-cd and virtio-scsi controller.
(qemu) device_del scsi_cd
(qemu) device_del scsi1
4. hot-plug a virtio-scsi controller.
(qemu) device_add virtio-scsi-pci,id=scsi1
5. hot-plug a virtio-cd.
(qemu) device_add scsi-cd,drive=cd,id=scsi_cd

Actual results:
after the step 4, the aborted occurs as following,
(qemu) device_add virtio-scsi-pci,id=scsi1
qemu-kvm: savevm.c:1190: register_savevm_live: Assertion `!se->compat || se->instance_id == 0' failed.
Aborted  

Expected results:
we should hot-plug a virtio-scsi controller and virtio-cd successfully without any fails.

Additional info:
If we do not hot-unplug the virtio-scsi controller, and only hot-unplug virtio-cd in the step 3, and then we could hot-plug the virtio-cd successfully.

Comment 2 juzhang 2012-03-06 08:26:05 UTC
Please free to add FRE if we do not support (hot plug/unplug virtio-scsi controller(pci device)),mark qa_ack+ first.

Comment 3 Paolo Bonzini 2012-03-19 15:42:13 UTC
In step 4 I get

(qemu) device_add virtio-scsi-pci,id=scsi1
Duplicate ID 'scsi1' for device

If I use scsi2, I can hotplug successfully with

(qemu) __com.redhat_drive_add file=/home/pbonzini/Download/boot-RHEL-6.2.iso,id=cd
(qemu) device_add scsi-cd,drive=cd,id=scsi_cd

So, I suspect that if you used scsi2 it would also go away.  Can you try doing the same with libvirt and see if it would fail?

If using scsi2 does not fix the problem, can you please provide a backtrace from gdb?

Moving to 6.4, but it's possible that the patch for bug 800710 fixes it.

Comment 4 Paolo Bonzini 2012-03-27 15:27:41 UTC
Please retest, as bug 800710 is now ON_QA.

Comment 5 Sibiao Luo 2012-03-28 05:01:06 UTC
(In reply to comment #4)
> Please retest, as bug 800710 is now ON_QA.

Hi Paolo,
 
   I have retested it for several times on qemu-kvm-0.12.1.2-2.265.el6.x86_64, the result of my test is that the aborted do not occur, it works well. 

(qemu) info block
hd: removable=0 io-status=ok file=/home/rhel6.3-64.qcow2 ro=0 drv=qcow2 encrypted=0
cd: removable=1 locked=0 tray-open=0 io-status=ok file=/home/en_windows_xp_professional_x64.iso ro=0 drv=raw encrypted=0
ide1-cd0: removable=1 locked=0 tray-open=0 io-status=ok [not inserted]
floppy0: removable=1 locked=0 tray-open=0 [not inserted]
sd0: removable=1 locked=0 tray-open=0 [not inserted]
(qemu) device_del scsi_cd
(qemu) device_del scsi1
(qemu) info block
hd: removable=0 io-status=ok file=/home/rhel6.3-64.qcow2 ro=0 drv=qcow2 encrypted=0
ide1-cd0: removable=1 locked=0 tray-open=0 io-status=ok [not inserted]
floppy0: removable=1 locked=0 tray-open=0 [not inserted]
sd0: removable=1 locked=0 tray-open=0 [not inserted]
(qemu) device_add virtio-scsi-pci,id=scsi1
(qemu) __com.redhat_drive_add file=/home/en_windows_xp_professional_x64.iso,id=cd
(qemu) device_add scsi-cd,drive=cd,id=scsi_cd
(qemu) info block
hd: removable=0 io-status=ok file=/home/rhel6.3-64.qcow2 ro=0 drv=qcow2 encrypted=0
ide1-cd0: removable=1 locked=0 tray-open=0 io-status=ok [not inserted]
floppy0: removable=1 locked=0 tray-open=0 [not inserted]
sd0: removable=1 locked=0 tray-open=0 [not inserted]
cd: removable=1 locked=0 tray-open=0 io-status=ok file=/home/en_windows_xp_professional_x64.iso ro=0 drv=raw encrypted=0

Above all, this issue has been fixed on the latest qemu-kvm version.

Comment 6 Paolo Bonzini 2012-03-28 06:50:41 UTC
Closing as dup then, thanks for the quick test!

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