Rather than pass the whole drive string (which contained the alias), pass only the alias for the qemuMonitorDriveDel call in the error path when adding a host device in the monitor fails. Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx> --- src/qemu/qemu_hotplug.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 4d3e913..eaf4e46 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -1996,6 +1996,7 @@ qemuDomainAttachHostSCSIDevice(virConnectPtr conn, virErrorPtr orig_err; char *devstr = NULL; char *drvstr = NULL; + char *drivealias = NULL; bool teardowncgroup = false; bool teardownlabel = false; bool driveAdded = false; @@ -2054,6 +2055,9 @@ qemuDomainAttachHostSCSIDevice(virConnectPtr conn, if (!(drvstr = qemuBuildSCSIHostdevDrvStr(hostdev))) goto cleanup; + if (!(drivealias = qemuAssignSCSIHostDeviceDriveAlias(hostdev))) + goto cleanup; + if (!(devstr = qemuBuildSCSIHostdevDevStr(vm->def, hostdev, priv->qemuCaps))) goto cleanup; @@ -2089,13 +2093,14 @@ qemuDomainAttachHostSCSIDevice(virConnectPtr conn, vm->def, hostdev, NULL) < 0) VIR_WARN("Unable to restore host device labelling on hotplug fail"); } + VIR_FREE(drivealias); VIR_FREE(drvstr); VIR_FREE(devstr); return ret; exit_monitor: orig_err = virSaveLastError(); - if (driveAdded && qemuMonitorDriveDel(priv->mon, drvstr) < 0) { + if (driveAdded && qemuMonitorDriveDel(priv->mon, drivealias) < 0) { VIR_WARN("Unable to remove drive %s (%s) after failed " "qemuMonitorAddDevice", drvstr, devstr); -- 2.5.5 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list