mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-15 17:15:18 +00:00
qemu_hotplug: Use more gotos in qemuDomainDetach*Device
We are overwriting @ret a lot. It makes hard to see what is actually going on. Use more gotos. Two functions are fixed here: qemuDomainDetachShmemDevice() and qemuDomainDetachWatchdog(). Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
ee87e5de36
commit
e73f6b4d66
@ -5283,19 +5283,20 @@ qemuDomainDetachShmemDevice(virQEMUDriverPtr driver,
|
|||||||
}
|
}
|
||||||
|
|
||||||
qemuDomainMarkDeviceForRemoval(vm, &shmem->info);
|
qemuDomainMarkDeviceForRemoval(vm, &shmem->info);
|
||||||
|
|
||||||
qemuDomainObjEnterMonitor(driver, vm);
|
qemuDomainObjEnterMonitor(driver, vm);
|
||||||
|
if (qemuMonitorDelDevice(priv->mon, shmem->info.alias) < 0) {
|
||||||
ret = qemuMonitorDelDevice(priv->mon, shmem->info.alias);
|
ignore_value(qemuDomainObjExitMonitor(driver, vm));
|
||||||
|
goto cleanup;
|
||||||
if (qemuDomainObjExitMonitor(driver, vm) < 0)
|
|
||||||
ret = -1;
|
|
||||||
|
|
||||||
if (ret == 0) {
|
|
||||||
if ((ret = qemuDomainWaitForDeviceRemoval(vm)) == 1)
|
|
||||||
ret = qemuDomainRemoveShmemDevice(driver, vm, shmem);
|
|
||||||
}
|
}
|
||||||
qemuDomainResetDeviceRemoval(vm);
|
if (qemuDomainObjExitMonitor(driver, vm) < 0)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
if ((ret = qemuDomainWaitForDeviceRemoval(vm)) == 1)
|
||||||
|
ret = qemuDomainRemoveShmemDevice(driver, vm, shmem);
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
qemuDomainResetDeviceRemoval(vm);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5336,19 +5337,20 @@ qemuDomainDetachWatchdog(virQEMUDriverPtr driver,
|
|||||||
}
|
}
|
||||||
|
|
||||||
qemuDomainMarkDeviceForRemoval(vm, &watchdog->info);
|
qemuDomainMarkDeviceForRemoval(vm, &watchdog->info);
|
||||||
|
|
||||||
qemuDomainObjEnterMonitor(driver, vm);
|
qemuDomainObjEnterMonitor(driver, vm);
|
||||||
|
if (qemuMonitorDelDevice(priv->mon, watchdog->info.alias) < 0) {
|
||||||
ret = qemuMonitorDelDevice(priv->mon, watchdog->info.alias);
|
ignore_value(qemuDomainObjExitMonitor(driver, vm));
|
||||||
|
goto cleanup;
|
||||||
if (qemuDomainObjExitMonitor(driver, vm) < 0)
|
|
||||||
ret = -1;
|
|
||||||
|
|
||||||
if (ret == 0) {
|
|
||||||
if ((ret = qemuDomainWaitForDeviceRemoval(vm)) == 1)
|
|
||||||
ret = qemuDomainRemoveWatchdog(driver, vm, watchdog);
|
|
||||||
}
|
}
|
||||||
qemuDomainResetDeviceRemoval(vm);
|
if (qemuDomainObjExitMonitor(driver, vm) < 0)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
if ((ret = qemuDomainWaitForDeviceRemoval(vm)) == 1)
|
||||||
|
ret = qemuDomainRemoveWatchdog(driver, vm, watchdog);
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
qemuDomainResetDeviceRemoval(vm);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user