conf: Automatically assign address to usb-net device

This patch will allow usb-net devices to be automatically assigned a USB
address (and skip any attempt to assign a PCI one).

Signed-off-by: Rayhan Faizel <rayhan.faizel@gmail.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
Rayhan Faizel 2024-04-02 14:48:35 +05:30 committed by Peter Krempa
parent d37a4aa69c
commit e18c69bcd8
3 changed files with 13 additions and 1 deletions

View File

@ -5608,6 +5608,7 @@ ne2k_pci pcnet rtl8139 e1000 virtio. :since:`Since 5.2.0`,
``virtio-transitional`` and ``virtio-non-transitional`` values are supported. ``virtio-transitional`` and ``virtio-non-transitional`` values are supported.
See `Virtio transitional devices`_ for more details. See `Virtio transitional devices`_ for more details.
:since:`Since 9.3.0` igb is also supported. :since:`Since 9.3.0` igb is also supported.
:since:`Since 10.3.0` usb-net is supported.
Setting NIC driver-specific options Setting NIC driver-specific options
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -28695,7 +28695,14 @@ virDomainUSBDeviceDefForeach(virDomainDef *def,
} }
} }
/* TODO: add def->nets here when libvirt starts supporting usb-net */ /* usb-net */
for (i = 0; i < def->nnets; i++) {
virDomainNetDef *net = def->nets[i];
if (net->model == VIR_DOMAIN_NET_MODEL_USB_NET) {
if (iter(&net->info, opaque) < 0)
return -1;
}
}
/* usb-ccid */ /* usb-ccid */
for (i = 0; i < def->ncontrollers; i++) { for (i = 0; i < def->ncontrollers; i++) {

View File

@ -2087,6 +2087,10 @@ qemuDomainAssignDevicePCISlots(virDomainDef *def,
for (i = 0; i < def->nnets; i++) { for (i = 0; i < def->nnets; i++) {
virDomainNetDef *net = def->nets[i]; virDomainNetDef *net = def->nets[i];
if (net->model == VIR_DOMAIN_NET_MODEL_USB_NET) {
continue;
}
/* type='hostdev' network devices might be USB, and are also /* type='hostdev' network devices might be USB, and are also
* in hostdevs list anyway, so handle them with other hostdevs * in hostdevs list anyway, so handle them with other hostdevs
* instead of here. * instead of here.