Bug 1043374

Summary: Refuse to start a domain with a USB disk attached to a PCI bus
Product: Red Hat Enterprise Linux 6 Reporter: Hu Jianwei <jiahu>
Component: libvirtAssignee: Jiri Denemark <jdenemar>
Status: CLOSED WONTFIX QA Contact: Virtualization Bugs <virt-bugs>
Severity: low Docs Contact:
Priority: medium    
Version: 6.5CC: acathrow, bili, dyuan, honzhang, jdenemar, mzhan
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1043436 (view as bug list) Environment:
Last Closed: 2014-04-04 21:27:08 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:
Bug Depends On:    
Bug Blocks: 1043436    

Description Hu Jianwei 2013-12-16 06:43:11 UTC
Description of problem:
Libvirt should check unnecessary pci-address for usb type disk before starting domain

Version-Release number of selected component (if applicable):
libvirt-0.10.2-29.el6.x86_64
qemu-kvm-0.12.1.2-2.398.el6.x86_64
kernel-2.6.32-412.el6.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Edit domain and add a unavailable pci address to usb disk
   <disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/usb-img/usb.img'/>
      <target dev='sdd' bus='usb'/>
      <alias name='usb-disk3'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
    </disk>

2. Dump domain xml
[root@test777 ~]# virsh dumpxml r6
...
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/usb-img/usb.img'/>
      <target dev='sdd' bus='usb'/>
      <alias name='usb-disk3'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
    </disk>
...

3. Start domain
[root@test777 ~]# virsh start r6
Domain r6 started

[root@test777 ~]# virsh dumpxml r6
...
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/usb-img/usb.img'/>
      <target dev='sdd' bus='usb'/>
      <alias name='usb-disk3'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
    </disk>
...

Actual results:
See above steps.

Expected results:
Libvirt should fail to start domain when we configure some wrong elements for usb disk. The expected results should be same as below:

Need give error info like bus='ide' or bus='scsi':
# virsh start rhel6u2
error: Failed to start domain rhel6u2
error: internal error unexpected address type for ide disk

# virsh start rhel6u2
error: Failed to start domain rhel6u2
error: internal error unexpected address type for scsi disk


Additional info:
On rhel7 host, I can not reproduce it.

Version:
libvirt-1.1.1-13.el7.x86_64
qemu-kvm-1.5.3-19.el7.x86_64
kernel-3.10.0-54.el7.x86_64

[root@ibm-x3850x5-07 216365]# virsh dumpxml r7
...
<disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/usb-img/usb-a-a.img'/>
      <target dev='sdd' bus='usb'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x0e' function='0x0'/>
    </disk>
...

[root@ibm-x3850x5-07 216365]# virsh start r7
error: Failed to start domain r7
error: internal error: early end of file from monitor: possible problem:
qemu-kvm: -device usb-storage,bus=pci.0,addr=0xe,drive=drive-usb-disk3,id=usb-disk3: Device 'usb-storage' can't go on a PCI bus

Comment 2 RHEL Program Management 2014-04-04 21:27:08 UTC
Development Management has reviewed and declined this request.
You may appeal this decision by reopening this request.