From: Cole Robinson Date: Thu, 5 Dec 2013 19:59:05 +0000 (-0500) Subject: qemu: hotplug: Fix adding USB devices to the driver list X-Git-Tag: v1.1.3.2~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=acc55b672800419d61303fbbde8a8128c79b0c67;p=thirdparty%2Flibvirt.git qemu: hotplug: Fix adding USB devices to the driver list We were unconditionally removing the device from the host list, when it should only be done on error. This fixes USB collision detection when hotplugging the same device to two guests. (cherry picked from commit 586b0ed81828a443717b018989f2bced1bcfac01) --- diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 96033ac54c..a483b4de60 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -1498,9 +1498,9 @@ cleanup: virSecurityManagerRestoreHostdevLabel(driver->securityManager, vm->def, hostdev, NULL) < 0) VIR_WARN("Unable to restore host device labelling on hotplug fail"); + if (added) + virUSBDeviceListSteal(driver->activeUsbHostdevs, usb); } - if (added) - virUSBDeviceListSteal(driver->activeUsbHostdevs, usb); if (list && usb && !virUSBDeviceListFind(list, usb) && !virUSBDeviceListFind(driver->activeUsbHostdevs, usb))