Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1351444

Summary: VM is killed after hotplug scsi device (passthrough) fails
Product: Red Hat Enterprise Linux 7 Reporter: Yang Yang <yanyang>
Component: qemu-kvm-rhevAssignee: Ademar Reis <areis>
Status: CLOSED DUPLICATE QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.3CC: chayang, famz, huding, juzhang, knoel, pbonzini, pezhang, virt-maint, yanyang
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-01 03:36:42 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 Yang Yang 2016-06-30 06:14:49 UTC
Description of problem:
I have only 1 scsi controller#0 defined in guest. And I hotplug scsi device with a bad address. After that, vm is killed. It cannot be reproduced with qemu-7.2.z

Version-Release number of selected component (if applicable):
qemu-kvm-rhev-2.6.0-9.el7.x86_64
libvirt-1.3.5-1.el7.x86_64
3.10.0-445.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1. prepare a running vm
 <controller type='scsi' index='0'>
      <alias name='scsi0'/>
      <address type='pci' domain='0x0000' bus='0x01' slot='0x01' function='0x0'/>
    </controller>

# virsh start vm1
Domain vm1 started
# virsh list
 Id    Name                           State
----------------------------------------------------
 70    vm1                            running

#ps -ef|grep qemu
/usr/libexec/qemu-kvm -name guest=vm1,debug-threads=on -S -object secret,id=masterKey0,format=raw,file=/var/lib/libvirt/qemu/domain-37-vm1/master-key.aes -machine pc-i440fx-rhel7.2.0,accel=kvm,usb=off -m 1024 -realtime mlock=off -smp 4,sockets=1,cores=2,threads=2 -uuid 471fc3b6-6079-4c92-a027-414878a4f4db -no-user-config -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/domain-37-vm1/monitor.sock,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc,driftfix=slew -global kvm-pit.lost_tick_policy=discard -no-hpet -no-shutdown -global PIIX4_PM.disable_s3=1 -global PIIX4_PM.disable_s4=0 -boot strict=on -device pci-bridge,chassis_nr=1,id=pci.1,bus=pci.0,addr=0xb -device ich9-usb-ehci1,id=usb,bus=pci.0,addr=0x6.0x7 -device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pci.0,multifunction=on,addr=0x6 -device ich9-usb-uhci2,masterbus=usb.0,firstport=2,bus=pci.0,addr=0x6.0x1 -device ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=pci.0,addr=0x6.0x2 -device virtio-scsi-pci,id=scsi0,bus=pci.0,addr=0x7 -device ahci,id=sata0,bus=pci.0,addr=0x8 -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x5 -drive file=/mnt/nfs2/RHEL-7.3-latest.qcow2,format=qcow2,if=none,id=drive-virtio-disk0 -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x9,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 -drive file=/var/lib/libvirt/images/boot.iso,format=raw,if=none,id=drive-ide0-0-0,readonly=on -device ide-cd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 -netdev tap,fd=27,id=hostnet0 -device rtl8139,netdev=hostnet0,id=net0,mac=52:54:00:5d:44:cb,bus=pci.0,addr=0x3 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -chardev spicevmc,id=charchannel0,name=vdagent -device virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=com.redhat.spice.0 -spice port=5901,addr=127.0.0.1,disable-ticketing,seamless-migration=on -device qxl-vga,id=video0,ram_size=67108864,vram_size=67108864,vram64_size_mb=0,vgamem_mb=16,bus=pci.0,addr=0x2 -device intel-hda,id=sound0,bus=pci.0,addr=0x4 -device hda-duplex,id=sound0-codec0,bus=sound0.0,cad=0 -chardev spicevmc,id=charredir0,name=usbredir -device usb-redir,chardev=charredir0,id=redir0 -chardev spicevmc,id=charredir1,name=usbredir -device usb-redir,chardev=charredir1,id=redir1 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0xa -sandbox on -msg timestamp=on

2. hotplug scsi hostdev(passthrough) with incorrect address

# lsscsi
[0:0:0:0]    disk    ATA      SAMSUNG HD322GM  0101  /dev/sda 
[2:0:0:0]    cd/dvd  PLDS     DVD-ROM DH-16D5S VD15  /dev/sr0 
[6:0:0:0]    disk    Alcor    Flash Disk       8.07  /dev/sdb

# qemu-img info /dev/sdb
image: /dev/sdb
file format: raw
virtual size: 999M (1047527424 bytes)
disk size: 0


# cat hostdev.xml
<hostdev mode='subsystem' type='scsi' managed='no'>
      <source>
        <adapter name='scsi_host6'/>
        <address bus='0' target='0' unit='0'/>
      </source>
<address type='drive' controller='0' bus='1' target='1' unit='0'/>
    </hostdev>

# virsh attach-device vm1 hostdev.xml
error: Failed to attach device from hostdev.xml
error: internal error: unable to execute QEMU command 'device_add': bad scsi channel id: 1

3. check vm status
# virsh list --all
 Id    Name                           State
----------------------------------------------------
 -     vm1                            shut off

Actual results:
vm is killed after hotplug scsi device fails

Expected results:
vm is usable after hotplug scsi device fails

Additional info:
cat /var/log/libvirtd.log

2016-06-30 05:29:58.645+0000: 20219: info : qemuMonitorSend:1007 : QEMU_MONITOR_SEND_MSG: mon=0x7f8b70009760 msg={"execute":"__com.redhat_drive_add","arguments":{"file":"/dev/sg2","id":"drive-hostdev0"},"id":"libvirt-50"}^M
 fd=-1
2016-06-30 05:29:58.645+0000: 20214: info : qemuMonitorIOWrite:531 : QEMU_MONITOR_IO_WRITE: mon=0x7f8b70009760 buf={"execute":"__com.redhat_drive_add","arguments":{"file":"/dev/sg2","id":"drive-hostdev0"},"id":"libvirt-50"}^M
 len=110 ret=110 errno=0

2016-06-30 05:29:58.647+0000: 20219: info : qemuMonitorSend:1007 : QEMU_MONITOR_SEND_MSG: mon=0x7f8b70009760 msg={"execute":"device_add","arguments":{"driver":"scsi-generic","bus":"scsi0.0","channel":"1","scsi-id":"1","lun":"0","drive":"drive-hostdev0","id":"hostdev0"},"id":"libvirt-51"}

2016-06-30 05:29:58.647+0000: 20214: info : qemuMonitorIOWrite:531 : QEMU_MONITOR_IO_WRITE: mon=0x7f8b70009760 buf={"execute":"device_add","arguments":{"driver":"scsi-generic","bus":"scsi0.0","channel":"1","scsi-id":"1","lun":"0","drive":"drive-hostdev0","id":"hostdev0"},"id":"libvirt-51"}^M
 len=177 ret=177 errno=11

cat /var/log/libvirt/qemu/vm1.log
main_channel_link: add main channel client
main_channel_handle_parsed: net test: latency 0.176000 ms, bitrate 1407560137 bps (1342.353951 Mbps)
red_dispatcher_set_cursor_peer:
inputs_connect: inputs channel client create
WARNING: Image format was not specified for '/dev/sg2' and probing guessed raw.
         Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
         Specify the 'raw' format explicitly to remove the restrictions.
2016-06-30 06:00:47.592+0000: shutting down

Comment 3 Yang Yang 2016-07-01 03:36:13 UTC
Fam,

I re-tested it using scratch build. VM is not killed after hotplug fails. So it's a duplicated with bz 1341531

Thanks

Comment 4 Yang Yang 2016-07-01 03:36:42 UTC

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