Bug 1347550
| Summary: | Libvirt should forbid configuring usb virtual disk and smartcard when usb controller model is none | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux Advanced Virtualization | Reporter: | Pei Zhang <pzhang> |
| Component: | libvirt | Assignee: | Virtualization Maintenance <virt-maint> |
| Status: | CLOSED DEFERRED | QA Contact: | lijuan men <lmen> |
| Severity: | medium | Docs Contact: | |
| Priority: | medium | ||
| Version: | 8.0 | CC: | dyuan, jdenemar, jsuchane, jtomko, rbalakri, xuzhang |
| Target Milestone: | rc | Keywords: | Triaged |
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | libvirt-4.3.0-1.el7 | Doc Type: | If docs needed, set a value |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2020-02-11 13:17:59 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: | |||
Since the USB addresses allocation, libvirt already reports an error: error: internal error: No free USB ports However the error message could be friendlier. Pushed upstream as:
commit 1cdc9ecebd0bf22ea658b84c2466e2ea237f1897
Author: Ján Tomko <jtomko>
CommitDate: 2018-03-07 14:10:46 +0100
qemu: report a nicer error when USB is disabled
If the user tries to define a domain that has
<controller type='usb' model='none'/>
and also some USB devices, we report an error:
error: internal error: No free USB ports
Which is technically still correct for a domain with no USB ports.
Change it to:
USB is disabled for this domain, but USB devices are present in the domain XML
https://bugzilla.redhat.com/show_bug.cgi?id=1347550
Signed-off-by: Ján Tomko <jtomko>
git describe: v4.1.0-49-g1cdc9eceb
test in version libvirt-4.5.0-9.el7.x86_64
when I test hostdev scenario,the result is still the same as step 4.2 in this bug's Description
detailed steps:
1. define a guest like following
......
<controller type='usb' index='0' model='none'/>
......
2.add usb hostdev to guest xml.
#cat usb-host.xml
<hostdev mode='subsystem' type='usb' managed='no'>
<source>
<vendor id='0x15e1'/>
<product id='0x2007'/>
</source>
</hostdev>
[root@localhost ~]# virsh edit test
error: unsupported configuration: Can't add host USB device: USB is disabled ****in this host****
Failed. Try again? [y,n,i,f,?]:
Does this error message need to be fixed?
the results of other test scenarios are as followed,all pass
version:
libvirt-4.5.0-9.el7.x86_64
qemu-kvm-rhev-2.12.0-14.el7.x86_64
scenario1:smartcard
1. define a guest like following
......
<controller type='usb' index='0' model='none'/>
......
2. virsh edit guest, add following xml :
<controller type='ccid' index='0'/>
<smartcard mode='passthrough' type='spicevmc'>
<address type='ccid' controller='0' slot='0'/>
</smartcard>
[root@localhost ~]# virsh edit test
error: unsupported configuration: USB is disabled for this domain, but USB devices are present in the domain XML
Failed. Try again? [y,n,i,f,?]:
scenario2:virtual usb disk
1. virsh edit guest, add virtual usb disk, save configuration
#cat usb-virtual-disk.xml
<disk type='block' device='disk'>
<driver name='qemu' type='raw'/>
<source dev='/dev/sdb'/>
<target dev='sde' bus='usb'/>
</disk>
2.[root@localhost ~]# virsh edit test
error: unsupported configuration: USB is disabled for this domain, but USB devices are present in the domain XML
Failed. Try again? [y,n,i,f,?]:
scenario3:rediredev
1.add usb rediredev to the guest
#cat usb-redir.xml
<redirdev bus='usb' type='spicevmc'>
</redirdev>
2.
[root@localhost ~]# virsh edit test
error: unsupported configuration: USB is disabled for this domain, but USB devices are present in the domain XML
Failed. Try again? [y,n,i,f,?]:
scenario4:hub
1.add usb hub to guest
<hub type='usb'>
</hub>
2.
[root@localhost ~]# virsh edit test
error: unsupported configuration: Can't add USB hub: USB is disabled for this domain
Failed. Try again? [y,n,i,f,?]:
FailQA and move to RHEL7.7 due to the issue in comment5, please correct me if you are not agree with this solution, thx. This bug was closed deferred as a result of bug triage. Please reopen if you disagree and provide justification why this bug should get enough priority. Most important would be information about impact on customer or layered product. Please indicate requested target release. |
Description of problem: Currently, when usb controller model is none, libvirt forbid configure usb hostdev, usb hub, usb redirdev. But it looks like it ignors the smartcard and virtual usb disk configuration. Version-Release number of selected component (if applicable): libvirt-1.3.5-1.el7.x86_64 qemu-kvm-rhev-2.6.0-5.el7.x86_64 How reproducible: 100% Steps to Reproduce: 1. define a guest like following ...... <controller type='usb' index='0' model='none'/> ...... 2. virsh edit guest, add following xml : <controller type='ccid' index='0'/> <smartcard mode='passthrough' type='spicevmc'> <address type='ccid' controller='0' slot='0'/> </smartcard> it can save successfully, and then try to start guest, it will fail to start. # virsh start r72-usb1 error: Failed to start domain r72-usb1 error: internal error: process exited while connecting to monitor: warning: host doesn't support requested feature: CPUID.80000001H:ECX.abm [bit 5] warning: host doesn't support requested feature: CPUID.80000001H:ECX.sse4a [bit 6] 2016-06-17T07:57:23.500560Z qemu-kvm: -device usb-ccid,id=ccid0: No 'usb-bus' bus found for device 'usb-ccid' 3. virsh edit guest, add virtual usb disk, save configuration and start #cat usb-virtual-disk.xml <disk type='block' device='disk'> <driver name='qemu' type='raw'/> <source dev='/dev/sde'/> <target dev='sde' bus='usb'/> </disk> # virsh start r72-usb1 error: Failed to start domain r72-usb1 error: internal error: early end of file from monitor, possible problem: ce virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x5 -drive file=/tmp/zp/r7.2.qcow2,format=qcow2,if=none,id=drive-virtio-disk0 -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x7,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 -drive file=/dev/sde,format=raw,if=none,id=drive-usb-disk4 -device usb-storage,drive=drive-usb-disk4,id=usb-disk4,removable=off ...... 4. delete configurations in step2 and step3, add usb rediredev and usb hostdev to guest, 4.1 virsh edit add following xml: #cat usb-redir.xml <redirdev bus='usb' type='spicevmc'> </redirdev> save will get following error : # virsh edit r72-usb1 error: unsupported configuration: Can't add redirected USB device: USB is disabled for this domain Failed. Try again? [y,n,i,f,?]: 4.2 virsh edit add usb hostdev to guest xml. #cat usb-host.xml <hostdev mode='subsystem' type='usb' managed='no'> <source> <vendor id='0x15e1'/> <product id='0x2007'/> </source> </hostdev> # virsh edit r72-usb1 error: unsupported configuration: Can't add host USB device: USB is disabled in this host Failed. Try again? [y,n,i,f,?]: Actuall I think this error also should be changed to "USB is disabled for this domain" Actual results: As step2 and step3, libvirt will not forbid configuring smartcard and virtual usb disk when usb controller model is none. Expected results: As step4, it should forbid configuring and give error message like "USB is disabled for this domain" Additional info: