提交 1cc2889f 编写于 作者: P Peter Krempa

qemu: hotplug: Assume QEMU_CAPS_DEVICE in qemuDomainAttachUSBMassStorageDevice

上级 3fbc7b78
...@@ -665,32 +665,26 @@ qemuDomainAttachUSBMassStorageDevice(virConnectPtr conn, ...@@ -665,32 +665,26 @@ qemuDomainAttachUSBMassStorageDevice(virConnectPtr conn,
goto error; goto error;
} }
if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) { if (qemuAssignDeviceDiskAlias(vm->def, disk, priv->qemuCaps) < 0)
if (qemuAssignDeviceDiskAlias(vm->def, disk, priv->qemuCaps) < 0) goto error;
goto error; if (!(drivestr = qemuBuildDriveStr(conn, disk, false, priv->qemuCaps)))
if (!(drivestr = qemuBuildDriveStr(conn, disk, false, priv->qemuCaps))) goto error;
goto error; if (!(devstr = qemuBuildDriveDevStr(vm->def, disk, 0, priv->qemuCaps)))
if (!(devstr = qemuBuildDriveDevStr(vm->def, disk, 0, priv->qemuCaps))) goto error;
goto error;
}
if (VIR_REALLOC_N(vm->def->disks, vm->def->ndisks+1) < 0) if (VIR_REALLOC_N(vm->def->disks, vm->def->ndisks+1) < 0)
goto error; goto error;
qemuDomainObjEnterMonitor(driver, vm); qemuDomainObjEnterMonitor(driver, vm);
if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) { ret = qemuMonitorAddDrive(priv->mon, drivestr);
ret = qemuMonitorAddDrive(priv->mon, drivestr); if (ret == 0) {
if (ret == 0) { ret = qemuMonitorAddDevice(priv->mon, devstr);
ret = qemuMonitorAddDevice(priv->mon, devstr); if (ret < 0) {
if (ret < 0) { VIR_WARN("qemuMonitorAddDevice failed on %s (%s)",
VIR_WARN("qemuMonitorAddDevice failed on %s (%s)", drivestr, devstr);
drivestr, devstr); /* XXX should call 'drive_del' on error but this does not
/* XXX should call 'drive_del' on error but this does not exist yet */
exist yet */
}
} }
} else {
ret = qemuMonitorAddUSBDisk(priv->mon, src);
} }
if (qemuDomainObjExitMonitor(driver, vm) < 0) { if (qemuDomainObjExitMonitor(driver, vm) < 0) {
ret = -1; ret = -1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册