mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-24 05:25:18 +00:00
qemu: hotplug: Assume QEMU_CAPS_DEVICE in qemuDomainAttachHostUSBDevice
This commit is contained in:
parent
1cc2889f71
commit
dd3e9a0a7d
@ -1884,23 +1884,16 @@ qemuDomainAttachHostUSBDevice(virQEMUDriverPtr driver,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
teardownlabel = true;
|
teardownlabel = true;
|
||||||
|
|
||||||
if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
|
if (qemuAssignDeviceHostdevAlias(vm->def, &hostdev->info->alias, -1) < 0)
|
||||||
if (qemuAssignDeviceHostdevAlias(vm->def, &hostdev->info->alias, -1) < 0)
|
goto cleanup;
|
||||||
goto cleanup;
|
if (!(devstr = qemuBuildUSBHostdevDevStr(vm->def, hostdev, priv->qemuCaps)))
|
||||||
if (!(devstr = qemuBuildUSBHostdevDevStr(vm->def, hostdev, priv->qemuCaps)))
|
goto cleanup;
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (VIR_REALLOC_N(vm->def->hostdevs, vm->def->nhostdevs+1) < 0)
|
if (VIR_REALLOC_N(vm->def->hostdevs, vm->def->nhostdevs+1) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
qemuDomainObjEnterMonitor(driver, vm);
|
qemuDomainObjEnterMonitor(driver, vm);
|
||||||
if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE))
|
ret = qemuMonitorAddDevice(priv->mon, devstr);
|
||||||
ret = qemuMonitorAddDevice(priv->mon, devstr);
|
|
||||||
else
|
|
||||||
ret = qemuMonitorAddUSBDeviceExact(priv->mon,
|
|
||||||
hostdev->source.subsys.u.usb.bus,
|
|
||||||
hostdev->source.subsys.u.usb.device);
|
|
||||||
if (qemuDomainObjExitMonitor(driver, vm) < 0) {
|
if (qemuDomainObjExitMonitor(driver, vm) < 0) {
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user