a278eea708
- Update to libvirt 2.2.0 - Many incremental improvements and bug fixes, see http://libvirt.org/news.html - Dropped patches: 856965b3-qemu-secdriver.patch, 541e9ae6-cpu-vendor-crash-fix.patch, d53d4650-qemu-rbd-auth.patch OBS-URL: https://build.opensuse.org/request/show/424555 OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=565
62 lines
2.1 KiB
Diff
62 lines
2.1 KiB
Diff
commit e7af9dcf1fb0703828ef9740cb9b9c00f2fa00a4
|
|
Author: Cédric Bosdonnat <cbosdonnat@suse.com>
|
|
Date: Fri Aug 5 09:10:50 2016 +0200
|
|
|
|
libxl: allow vendor/product addressing for USB hostdevs
|
|
|
|
libxl only has API to address the host USB devices by bus/device.
|
|
Find the bus/device if the user only provided the vendor/product
|
|
of the USB device.
|
|
|
|
Index: libvirt-2.2.0/src/libxl/libxl_conf.c
|
|
===================================================================
|
|
--- libvirt-2.2.0.orig/src/libxl/libxl_conf.c
|
|
+++ libvirt-2.2.0/src/libxl/libxl_conf.c
|
|
@@ -1559,23 +1559,36 @@ int
|
|
libxlMakeUSB(virDomainHostdevDefPtr hostdev, libxl_device_usbdev *usbdev)
|
|
{
|
|
virDomainHostdevSubsysUSBPtr usbsrc = &hostdev->source.subsys.u.usb;
|
|
+ virUSBDevicePtr usb = NULL;
|
|
+ int ret = -1;
|
|
|
|
if (hostdev->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS)
|
|
- return -1;
|
|
+ goto cleanup;
|
|
if (hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB)
|
|
- return -1;
|
|
+ goto cleanup;
|
|
|
|
- if (usbsrc->bus <= 0 || usbsrc->device <= 0) {
|
|
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
|
- _("libxenlight supports only USB device "
|
|
- "specified by busnum:devnum"));
|
|
- return -1;
|
|
+ if (usbsrc->bus > 0 && usbsrc->device > 0) {
|
|
+ usbdev->u.hostdev.hostbus = usbsrc->bus;
|
|
+ usbdev->u.hostdev.hostaddr = usbsrc->device;
|
|
+ } else {
|
|
+ if (virHostdevFindUSBDevice(hostdev, true, &usb) < 0) {
|
|
+ virReportError(VIR_ERR_OPERATION_FAILED,
|
|
+ _("failed to find USB device busnum:devnum "
|
|
+ "for %x:%x"),
|
|
+ usbsrc->vendor, usbsrc->product);
|
|
+ goto cleanup;
|
|
+ }
|
|
+
|
|
+ usbdev->u.hostdev.hostbus = virUSBDeviceGetBus(usb);
|
|
+ usbdev->u.hostdev.hostaddr = virUSBDeviceGetDevno(usb);
|
|
}
|
|
|
|
- usbdev->u.hostdev.hostbus = usbsrc->bus;
|
|
- usbdev->u.hostdev.hostaddr = usbsrc->device;
|
|
+ ret = 0;
|
|
+
|
|
+ cleanup:
|
|
+ virUSBDeviceFree(usb);
|
|
|
|
- return 0;
|
|
+ return ret;
|
|
}
|
|
|
|
static int
|