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

Jiri Denemark jdenemar at redhat.com
Mon Dec 9 12:09:20 UTC 2013


On Thu, Dec 05, 2013 at 15:40:28 -0500, Cole Robinson wrote:
> 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))

ACK

Jirka




More information about the libvir-list mailing list