提交 586b0ed8 编写于 作者: C Cole Robinson

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.
上级 5953a737
...@@ -1515,9 +1515,9 @@ cleanup: ...@@ -1515,9 +1515,9 @@ cleanup:
virSecurityManagerRestoreHostdevLabel(driver->securityManager, virSecurityManagerRestoreHostdevLabel(driver->securityManager,
vm->def, hostdev, NULL) < 0) vm->def, hostdev, NULL) < 0)
VIR_WARN("Unable to restore host device labelling on hotplug fail"); 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 && if (list && usb &&
!virUSBDeviceListFind(list, usb) && !virUSBDeviceListFind(list, usb) &&
!virUSBDeviceListFind(driver->activeUsbHostdevs, usb)) !virUSBDeviceListFind(driver->activeUsbHostdevs, usb))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册