[PATCH 3/3] qemu: hotplug: Fix adding USB devices to the driver list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.
---
 src/qemu/qemu_hotplug.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index b7512a7..16b990d 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -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))
-- 
1.8.4.2

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]