Bug 914883
Summary: | RFE: domain: allow specifying USB devices by their host port | ||||||
---|---|---|---|---|---|---|---|
Product: | [Community] Virtualization Tools | Reporter: | Hedayat Vatankhah <hedayatv> | ||||
Component: | libvirt | Assignee: | Libvirt Maintainers <libvirt-maint> | ||||
Status: | CLOSED DEFERRED | QA Contact: | |||||
Severity: | unspecified | Docs Contact: | |||||
Priority: | unspecified | ||||||
Version: | unspecified | CC: | crobinso, jdenemar, jort.koopmans, josh, jtomko, mzhan, ribenakid, veillard | ||||
Target Milestone: | --- | ||||||
Target Release: | --- | ||||||
Hardware: | Unspecified | ||||||
OS: | Unspecified | ||||||
Whiteboard: | |||||||
Fixed In Version: | Doc Type: | Bug Fix | |||||
Doc Text: | Story Points: | --- | |||||
Clone Of: | Environment: | ||||||
Last Closed: | 2020-11-03 16:39:32 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: | |||||||
Attachments: |
|
Description
Hedayat Vatankhah
2013-02-23 06:55:29 UTC
Created attachment 760753 [details]
Patch to add optional serial id value to usb hostdev entry
I need this facility too (multiple USB DVB-T sticks with different aerial inputs, so the right one has to go to the right VM), so I've written a patch.
This patch adds the option to include a <serial id='serial-number'/> element in the hostdev/source element for a usb host device. If the element is present, then only usb devices with matching vendor id, product id _and_ serial number will match. If absent then any device matching vendor and product will match (as it is now).
The patch is a git patch against the current git head and I've tested it on Fedora 18.
David, would you mind sending the patch to libvirt-list? Instructions on how to do that easily from git can be found at http://www.libvirt.org/hacking.html ok, done that (I think). Indeed: https://www.redhat.com/archives/libvir-list/2013-June/msg00624.html thanks ! Daniel Doesn't look like this ever made it upstream, taking out of POST It seems the proper way to do this is by using libvirt's existing address/bus/device facility when adding usb hardware. I don't see any reason not to make this default behavior, actually. Josh, The issue is that in normal operation you cannot guarentee the address/bus/device that a USB device will be assigned as the device number is assigned dynamically by the kernel. If you plug in a USB device, note its device number, unplug it and then plug it back into exactly the same USB port again, it'll have a different device number. This also happens when a USB device is reset, which unfortunately happens when the VM a USB device attached to is shutdown and started again. So in normal operation simply shutting down a VM and then starting again will lose the USB device that was attached. The current work around is to use the device ID instead to find which address/bus/device a USB device has been given. Unfortunately if you have two identical devices libvirt will simply attach the first one it sees that is not already attached to a VM. The proposed solution is to use the device ID and serial number to differentiate between two identical devices so that a particular one can be found. Unfortunately the patch I gave was incomplete as far as unit tests and virt-manager integration was concerned and I have had no time to work on completing the patch to the maintainers satisfaction. I have reposted the patch back in June: https://www.redhat.com/archives/libvir-list/2014-June/msg00304.html It seems adding support for specifying the USB port in the address is the preferred way: https://www.redhat.com/archives/libvir-list/2014-June/msg00339.html But I haven't gotten around to doing that. Today I encountered this limitation, it seems this patch has not made it to libvirt yet. I have 2 devices which have the same Vendor and Product IDs, but different serials. I need to attach one to the VM. The Device number is indeed variable and does not work consistently. Therefore, a patch is highly anticipated and appreciated. Retitling to reflect danpb's suggested fix in the thread posted above There was a patch sent upstream recently for this: http://www.redhat.com/archives/libvir-list/2016-July/msg00127.html Thank you for reporting this issue to the libvirt project. Unfortunately we have been unable to resolve this issue due to insufficient maintainer capacity and it will now be closed. This is not a reflection on the possible validity of the issue, merely the lack of resources to investigate and address it, for which we apologise. If you none the less feel the issue is still important, you may choose to report it again at the new project issue tracker https://gitlab.com/libvirt/libvirt/-/issues The project also welcomes contribution from anyone who believes they can provide a solution. |