qemu: Move exit monitor calls in failure paths

Since qemuDomainObjExitMonitor can also generate error messages,
let's move it inside any error message saving code on error paths
for various hotplug add activities.

Signed-off-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
John Ferlan 2017-02-22 12:39:17 -05:00
parent 7c2b7891cc
commit e49af42c22

View File

@ -442,13 +442,13 @@ qemuDomainAttachVirtioDiskDevice(virConnectPtr conn,
ignore_value(qemuMonitorDelObject(priv->mon, secinfo->s.aes.alias));
if (encobjAdded)
ignore_value(qemuMonitorDelObject(priv->mon, encinfo->s.aes.alias));
if (qemuDomainObjExitMonitor(driver, vm) < 0)
releaseaddr = false;
if (orig_err) {
virSetError(orig_err);
virFreeError(orig_err);
}
if (qemuDomainObjExitMonitor(driver, vm) < 0)
releaseaddr = false;
virDomainAuditDisk(vm, NULL, disk->src, "attach", false);
@ -728,13 +728,12 @@ qemuDomainAttachSCSIDisk(virConnectPtr conn,
ignore_value(qemuMonitorDelObject(priv->mon, secinfo->s.aes.alias));
if (encobjAdded)
ignore_value(qemuMonitorDelObject(priv->mon, encinfo->s.aes.alias));
ignore_value(qemuDomainObjExitMonitor(driver, vm));
if (orig_err) {
virSetError(orig_err);
virFreeError(orig_err);
}
ignore_value(qemuDomainObjExitMonitor(driver, vm));
virDomainAuditDisk(vm, NULL, disk->src, "attach", false);
error:
@ -822,12 +821,12 @@ qemuDomainAttachUSBMassStorageDevice(virQEMUDriverPtr driver,
VIR_WARN("Unable to remove drive %s (%s) after failed "
"qemuMonitorAddDevice", drivealias, drivestr);
}
ignore_value(qemuDomainObjExitMonitor(driver, vm));
if (orig_err) {
virSetError(orig_err);
virFreeError(orig_err);
}
ignore_value(qemuDomainObjExitMonitor(driver, vm));
virDomainAuditDisk(vm, NULL, disk->src, "attach", false);
error:
@ -1679,11 +1678,11 @@ int qemuDomainAttachRedirdevDevice(virConnectPtr conn,
ignore_value(qemuMonitorDelObject(priv->mon, tlsAlias));
if (secobjAdded)
ignore_value(qemuMonitorDelObject(priv->mon, secAlias));
ignore_value(qemuDomainObjExitMonitor(driver, vm));
if (orig_err) {
virSetError(orig_err);
virFreeError(orig_err);
}
ignore_value(qemuDomainObjExitMonitor(driver, vm));
goto audit;
}
@ -1973,12 +1972,12 @@ int qemuDomainAttachChrDevice(virConnectPtr conn,
ignore_value(qemuMonitorDelObject(priv->mon, tlsAlias));
if (secobjAdded)
ignore_value(qemuMonitorDelObject(priv->mon, secAlias));
ignore_value(qemuDomainObjExitMonitor(driver, vm));
if (orig_err) {
virSetError(orig_err);
virFreeError(orig_err);
}
ignore_value(qemuDomainObjExitMonitor(driver, vm));
goto audit;
}
@ -2159,13 +2158,13 @@ qemuDomainAttachRNGDevice(virConnectPtr conn,
ignore_value(qemuMonitorDelObject(priv->mon, tlsAlias));
if (secobjAdded)
ignore_value(qemuMonitorDelObject(priv->mon, secAlias));
if (qemuDomainObjExitMonitor(driver, vm) < 0)
releaseaddr = false;
if (orig_err) {
virSetError(orig_err);
virFreeError(orig_err);
}
if (qemuDomainObjExitMonitor(driver, vm) < 0)
releaseaddr = false;
goto audit;
}
@ -2279,14 +2278,14 @@ qemuDomainAttachMemory(virQEMUDriverPtr driver,
orig_err = virSaveLastError();
if (objAdded)
ignore_value(qemuMonitorDelObject(priv->mon, objalias));
if (qemuDomainObjExitMonitor(driver, vm) < 0)
mem = NULL;
if (orig_err) {
virSetError(orig_err);
virFreeError(orig_err);
}
if (qemuDomainObjExitMonitor(driver, vm) < 0) {
mem = NULL;
if (!mem)
goto audit;
}
removedef:
if ((id = virDomainMemoryFindByDef(vm->def, mem)) >= 0)
@ -2509,12 +2508,12 @@ qemuDomainAttachHostSCSIDevice(virConnectPtr conn,
"qemuMonitorAddDevice",
drvstr, devstr);
}
ignore_value(qemuDomainObjExitMonitor(driver, vm));
if (orig_err) {
virSetError(orig_err);
virFreeError(orig_err);
}
ignore_value(qemuDomainObjExitMonitor(driver, vm));
virDomainAuditHostdev(vm, hostdev, "attach", false);
goto cleanup;
@ -2801,14 +2800,14 @@ qemuDomainAttachShmemDevice(virQEMUDriverPtr driver,
ignore_value(qemuMonitorDelObject(priv->mon, memAlias));
}
if (qemuDomainObjExitMonitor(driver, vm) < 0)
release_address = false;
if (orig_err) {
virSetError(orig_err);
virFreeError(orig_err);
}
if (qemuDomainObjExitMonitor(driver, vm) < 0)
release_address = false;
goto audit;
}