mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 23:37:42 +00:00
qemu: hotplug: Assume QEMU_CAPS_DEVICE in qemuDomainAttachUSBMassStorageDevice
This commit is contained in:
parent
3fbc7b781c
commit
1cc2889f71
@ -665,32 +665,26 @@ qemuDomainAttachUSBMassStorageDevice(virConnectPtr conn,
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
|
||||
if (qemuAssignDeviceDiskAlias(vm->def, disk, priv->qemuCaps) < 0)
|
||||
goto error;
|
||||
if (!(drivestr = qemuBuildDriveStr(conn, disk, false, priv->qemuCaps)))
|
||||
goto error;
|
||||
if (!(devstr = qemuBuildDriveDevStr(vm->def, disk, 0, priv->qemuCaps)))
|
||||
goto error;
|
||||
}
|
||||
if (qemuAssignDeviceDiskAlias(vm->def, disk, priv->qemuCaps) < 0)
|
||||
goto error;
|
||||
if (!(drivestr = qemuBuildDriveStr(conn, disk, false, priv->qemuCaps)))
|
||||
goto error;
|
||||
if (!(devstr = qemuBuildDriveDevStr(vm->def, disk, 0, priv->qemuCaps)))
|
||||
goto error;
|
||||
|
||||
if (VIR_REALLOC_N(vm->def->disks, vm->def->ndisks+1) < 0)
|
||||
goto error;
|
||||
|
||||
qemuDomainObjEnterMonitor(driver, vm);
|
||||
if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
|
||||
ret = qemuMonitorAddDrive(priv->mon, drivestr);
|
||||
if (ret == 0) {
|
||||
ret = qemuMonitorAddDevice(priv->mon, devstr);
|
||||
if (ret < 0) {
|
||||
VIR_WARN("qemuMonitorAddDevice failed on %s (%s)",
|
||||
drivestr, devstr);
|
||||
/* XXX should call 'drive_del' on error but this does not
|
||||
exist yet */
|
||||
}
|
||||
ret = qemuMonitorAddDrive(priv->mon, drivestr);
|
||||
if (ret == 0) {
|
||||
ret = qemuMonitorAddDevice(priv->mon, devstr);
|
||||
if (ret < 0) {
|
||||
VIR_WARN("qemuMonitorAddDevice failed on %s (%s)",
|
||||
drivestr, devstr);
|
||||
/* XXX should call 'drive_del' on error but this does not
|
||||
exist yet */
|
||||
}
|
||||
} else {
|
||||
ret = qemuMonitorAddUSBDisk(priv->mon, src);
|
||||
}
|
||||
if (qemuDomainObjExitMonitor(driver, vm) < 0) {
|
||||
ret = -1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user