render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
c401cc
From 6ed8ba564d2e3dcf3a2e0413f5074630ce3eeb56 Mon Sep 17 00:00:00 2001
c401cc
Message-Id: <6ed8ba564d2e3dcf3a2e0413f5074630ce3eeb56.1386932210.git.jdenemar@redhat.com>
c401cc
From: Cole Robinson <crobinso@redhat.com>
c401cc
Date: Mon, 9 Dec 2013 20:12:45 +0100
c401cc
Subject: [PATCH] qemu: hotplug: Fix adding USB devices to the driver list
c401cc
c401cc
https://bugzilla.redhat.com/show_bug.cgi?id=1025108
c401cc
c401cc
We were unconditionally removing the device from the host list, when it
c401cc
should only be done on error.
c401cc
c401cc
This fixes USB collision detection when hotplugging the same device to
c401cc
two guests.
c401cc
c401cc
(cherry picked from commit 586b0ed81828a443717b018989f2bced1bcfac01)
c401cc
c401cc
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
c401cc
---
c401cc
 src/qemu/qemu_hotplug.c | 4 ++--
c401cc
 1 file changed, 2 insertions(+), 2 deletions(-)
c401cc
c401cc
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
c401cc
index a253a74..24a2096 100644
c401cc
--- a/src/qemu/qemu_hotplug.c
c401cc
+++ b/src/qemu/qemu_hotplug.c
c401cc
@@ -1374,9 +1374,9 @@ cleanup:
c401cc
             virSecurityManagerRestoreHostdevLabel(driver->securityManager,
c401cc
                                                   vm->def, hostdev, NULL) < 0)
c401cc
             VIR_WARN("Unable to restore host device labelling on hotplug fail");
c401cc
+        if (added)
c401cc
+            virUSBDeviceListSteal(driver->activeUsbHostdevs, usb);
c401cc
     }
c401cc
-    if (added)
c401cc
-        virUSBDeviceListSteal(driver->activeUsbHostdevs, usb);
c401cc
     if (list && usb &&
c401cc
         !virUSBDeviceListFind(list, usb) &&
c401cc
         !virUSBDeviceListFind(driver->activeUsbHostdevs, usb))
c401cc
-- 
c401cc
1.8.5.1
c401cc