Bug 1043436
| Summary: | Refuse to start a domain with a USB disk attached to a PCI bus | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | Jiri Denemark <jdenemar> |
| Component: | libvirt | Assignee: | Jiri Denemark <jdenemar> |
| Status: | CLOSED ERRATA | QA Contact: | Virtualization Bugs <virt-bugs> |
| Severity: | low | Docs Contact: | |
| Priority: | medium | ||
| Version: | 7.0 | CC: | dyuan, honzhang, jdenemar, mzhan, pzhang, rbalakri, xuzhang |
| Target Milestone: | rc | Flags: | pzhang:
needinfo-
|
| Target Release: | --- | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | libvirt-1.2.15-1.el7 | Doc Type: | Bug Fix |
| Doc Text: | Story Points: | --- | |
| Clone Of: | 1043374 | Environment: | |
| Last Closed: | 2015-11-19 05:44:26 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: | |||
| Bug Depends On: | 1043374 | ||
| Bug Blocks: | |||
|
Description
Jiri Denemark
2013-12-16 10:18:39 UTC
Patch sent upstream for review: https://www.redhat.com/archives/libvir-list/2015-April/msg01549.html Pushed upstream as v1.2.15-rc1-32-g6280294:
commit 6280294574473760b585ed2298e9512499ad7816
Author: Jiri Denemark <jdenemar>
Date: Thu Apr 30 14:16:40 2015 +0200
qemu: Check address type for USB disks
Only USB addresses are allowed for USB disks. Report an error if another
address is configured.
https://bugzilla.redhat.com/show_bug.cgi?id=1043436
Signed-off-by: Jiri Denemark <jdenemar>
I can reproduce it on libvirt-0.10.2-29.el6.x86_64 .
verify version:
libvirt-1.2.15-2.el7.x86_64
qemu-kvm-rhev-2.3.0-1.el7.x86_64
kernel-3.10.0-234.el7.x86_64
steps:
1.start a guest with a usb disk without address , guest xml like following :
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<source file='/var/lib/libvirt/images/qcow2.img'/>
<target dev='sde' bus='usb'/>
</disk>
Domain r7.2-new started
2.destroy guest and edit guest xml set usb disk with a PCI address
#virsh edit r7.2-new
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<source file='/var/lib/libvirt/images/qcow2.img'/>
<target dev='sde' bus='usb'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
</disk>
then start guest
#virsh start r7.2-new
error: Failed to start domain r7.2-new
error: internal error: unexpected address type for usb disk
3.destroy guest and edit guest xml set usb disk with address which type is drive
#virsh edit r7.2-new
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<source file='/var/lib/libvirt/images/qcow2.img'/>
<target dev='sde' bus='usb'/>
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
</disk>
#virsh start r7.2-new
error: Failed to start domain r7.2-new
error: internal error: unexpected address type for usb disk
4.destroy guest and edit guest xml set a usb disk with USB address
#virsh start r7.2-new
Domain r7.2-new started
#virsh dumpxml r7.2-new | grep disk -A 9
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<source file='/var/lib/libvirt/images/qcow2.img'/>
<backingStore/>
<target dev='sde' bus='usb'/>
<alias name='usb-disk4'/>
<address type='usb' bus='0' port='2'/>
</disk>
Now , libvirt refuse to start a domain with a USB disk configured with non USB addresses .
Hi ,
Jiri .
I also tested this scenario with host device . and I have found two issues during my testing . I wonder these can be modified in this patch or should open new bug to trace them .
Thanks in advance !
issue 1 : test with host USB device
problem : Start a guest with a host USB device which address is PCI , guest fail to start , but If it's better that libvirt forbid configure guest xml like this and no need to try to actually to start it .
1.start guest with host USB device with address type is pci
# virsh dumpxml r7.2-new | grep hostdev -A 9
<hostdev mode='subsystem' type='usb' managed='no'>
<source>
<vendor id='0x0781'/>
<product id='0x5567'/>
</source>
<address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/> <==== type is PCI
</hostdev>
#virsh start testvm
error: Failed to start domain testvm
error: internal error: process exited while connecting to monitor: 2015-05-22T05:23:29.677447Z qemu-kvm: -device usb-host,hostbus=2,hostaddr=6,id=hostdev0,bus=pci.0,addr=0xa: Device 'usb-host' can't go on a PCI bus
issue 2 : test with host scsi device
problem : For host scsi device , libvirt should also check if address configuration is valid. Start guest with host scsi device with address type is PCI , guest start successfully . Start guest with host scsi device with address type is usb , output unfriendly error message .
1.start guest with host scsi device with address type is pci
# virsh dumpxml testvm | grep hostdev -A 9
<hostdev mode='subsystem' type='scsi' managed='no'>
<source protocol='iscsi' name='iqn.2008-09.5.165.3ffe.104:server.target2/1'>
<host name='$IP' port='3260'/>
</source>
<alias name='hostdev1'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/> <=== type is PCI
</hostdev>
2.start guest , guest start successfully .
#virsh start r7.2-new
Domain r7.2-new started
# virsh dumpxml testvm | grep hostdev -A 9
<hostdev mode='subsystem' type='scsi' managed='no'>
<source protocol='iscsi' name='iqn.2008-09.5.165.3ffe.104:server.target2/1'>
<host name='$IP' port='3260'/>
</source>
<alias name='hostdev1'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/> <=== type is PCI
</hostdev>
3.start host scsi device with usb address
# virsh dumpxml r7.2-new |grep hostdev -A 9
<hostdev mode='subsystem' type='scsi' managed='no'>
<source protocol='iscsi' name='iqn.2008-09.5.165.3ffe.104:server.target2/1'>
<host name='10.66.5.165' port='3260'/>
</source>
<address type='usb' bus='0' port='1'/> <==== type is usb
</hostdev>
#virsh start r7.2-new
error: Failed to start domain r7.2-new
error: internal error: process exited while connecting to monitor: 2015-05-22T08:28:46.464675Z qemu-kvm: -device scsi-generic,bus=scsi0.0,channel=0,scsi-id=-1878988912,lun=32700,drive=usb-hostdev0,id=hostdev0: Parameter 'scsi-id' expects uint32_t
4.start a guest with host sscsi device and without address element , it will generated a address which type is 'drive'
<hostdev mode='subsystem' type='scsi' managed='no'>
<source protocol='iscsi' name='iqn.2008-09.5.165.3ffe.104:server.target2/1'>
<host name='10.66.5.165' port='3260'/>
</source>
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
</hostdev>
5.start scsi disk with pci address
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<source file='/var/lib/libvirt/images/qcow2.img'/>
<target dev='sde' bus='scsi'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
</disk>
#virsh start r7.2-new
error: Failed to start domain testvm
error: internal error: unexpected address type for scsi disk
As talked with my colleague , fill a bug to track issue in comment 7 https://bugzilla.redhat.com/show_bug.cgi?id=1225339 and according to comment 6 , move this bug to verified . 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://rhn.redhat.com/errata/RHBA-2015-2202.html |