Thanks, Daniel and Michal, for your review comments. I have incorporated
all comments and will submit a new patchset once Daniel's patch is
merged ("tests: validate an XML config with USB vendor/product set").
Am 26.06.2025 um 18:07 schrieb Daniel P. Berrangé via Devel:
On Thu, Jun 26, 2025 at 06:01:30PM +0200, Maximilian Martin wrote:
>
> Am 23.06.2025 um 16:50 schrieb Daniel P. Berrangé:
>> On Mon, Apr 21, 2025 at 09:38:34PM +0200, Maximilian Martin via Devel wrote:
>>> This resubmission splits up the previous patch into multiple patches and
>>> incorporates review comments from Michal Prívozník.
>>>
>>> Currently, only vendor/product and bus/device matching are supported for USB
host
>>> devices. Neither of these provide a stable and persistent way of assigning a
guest
>>> a specific host device. Vendor/product can be ambiguous. Device numbers
change on
>>> every enumeration.
>>>
>>> This patch adds a bus/port matching, which allows a specific port on the host
to be
>>> specified using the dotted notation found in Linux's "devpath"
sysfs attribute.
>> In terms of our API, we're expecting people to use the
>> 'node device' APIs to identify what devices are available
>> on the host and their attributes, rather than queryin
>> Linux directly. This gives us a platform independant
>> usage model, which also works when the mgmt app has no
>> login to the virt host.
>>
>>
>> Currently for USB devices we report bus, dev, vendor & product,
>> but don't report the port:
>>
>> # virsh nodedev-dumpxml usb_1_10_4
>> <device>
>> <name>usb_1_10_4</name>
>>
<path>/sys/devices/pci0000:00/0000:00:14.0/usb1/1-10/1-10.4</path>
>> <devnode type='dev'>/dev/bus/usb/001/004</devnode>
>> <parent>usb_1_10</parent>
>> <driver>
>> <name>usb</name>
>> </driver>
>> <capability type='usb_device'>
>> <bus>1</bus>
>> <device>4</device>
>> <product id='0x10c0'>Dell Integrated Hub</product>
>> <vendor id='0x1604'>Tascam</vendor>
>> </capability>
>> </device>
>>
>> we need to add 'port' to this xml document under the
'usb_device'
>> capability.
>>
> Well, the port is included in the path (everything after last '-'). udev
> does not report it explicitly. Do you think this is enough or should I parse
> the path and add the port to capabilites?
No, we would consider the path to be a platform specific opaque string,
and liable to change. So it isn't something apps should be parsing to
extract info from.
We need the path explicitly modelled under the usb_device capability
With regards,
Daniel