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.
This commit is contained in:
Cole Robinson 2013-12-05 14:59:05 -05:00
parent 5953a73787
commit 586b0ed818

View File

@ -1515,9 +1515,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))