mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 23:07:44 +00:00
qemu: Use the hostdev alias in qemuDomainAttachHostSCSIDevice error path
https://bugzilla.redhat.com/show_bug.cgi?id=1289391 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.
This commit is contained in:
parent
8527a25b32
commit
1149fe4c15
@ -2045,6 +2045,7 @@ qemuDomainAttachHostSCSIDevice(virConnectPtr conn,
|
|||||||
virErrorPtr orig_err;
|
virErrorPtr orig_err;
|
||||||
char *devstr = NULL;
|
char *devstr = NULL;
|
||||||
char *drvstr = NULL;
|
char *drvstr = NULL;
|
||||||
|
char *drivealias = NULL;
|
||||||
bool teardowncgroup = false;
|
bool teardowncgroup = false;
|
||||||
bool teardownlabel = false;
|
bool teardownlabel = false;
|
||||||
bool driveAdded = false;
|
bool driveAdded = false;
|
||||||
@ -2103,6 +2104,9 @@ qemuDomainAttachHostSCSIDevice(virConnectPtr conn,
|
|||||||
if (!(drvstr = qemuBuildSCSIHostdevDrvStr(hostdev)))
|
if (!(drvstr = qemuBuildSCSIHostdevDrvStr(hostdev)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
|
if (!(drivealias = qemuAliasFromHostdev(hostdev)))
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
if (!(devstr = qemuBuildSCSIHostdevDevStr(vm->def, hostdev, priv->qemuCaps)))
|
if (!(devstr = qemuBuildSCSIHostdevDevStr(vm->def, hostdev, priv->qemuCaps)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
@ -2138,13 +2142,14 @@ qemuDomainAttachHostSCSIDevice(virConnectPtr conn,
|
|||||||
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");
|
||||||
}
|
}
|
||||||
|
VIR_FREE(drivealias);
|
||||||
VIR_FREE(drvstr);
|
VIR_FREE(drvstr);
|
||||||
VIR_FREE(devstr);
|
VIR_FREE(devstr);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
exit_monitor:
|
exit_monitor:
|
||||||
orig_err = virSaveLastError();
|
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 "
|
VIR_WARN("Unable to remove drive %s (%s) after failed "
|
||||||
"qemuMonitorAddDevice",
|
"qemuMonitorAddDevice",
|
||||||
drvstr, devstr);
|
drvstr, devstr);
|
||||||
|
Loading…
Reference in New Issue
Block a user