mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
qemu: Introduce cleanup label in qemuProcessStart
Remove code duplication by moving common cleanup code in a dedicated label. Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
parent
93df3a9748
commit
d65ab51d74
@ -4365,6 +4365,7 @@ int qemuProcessStart(virConnectPtr conn,
|
|||||||
virNetDevVPortProfileOp vmop,
|
virNetDevVPortProfileOp vmop,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
|
int ret = -1;
|
||||||
int rv;
|
int rv;
|
||||||
off_t pos = -1;
|
off_t pos = -1;
|
||||||
char ebuf[1024];
|
char ebuf[1024];
|
||||||
@ -5095,13 +5096,15 @@ int qemuProcessStart(virConnectPtr conn,
|
|||||||
if (!migrateFrom)
|
if (!migrateFrom)
|
||||||
qemuMonitorSetDomainLog(priv->mon, -1);
|
qemuMonitorSetDomainLog(priv->mon, -1);
|
||||||
|
|
||||||
|
ret = 0;
|
||||||
|
|
||||||
|
cleanup:
|
||||||
virCommandFree(cmd);
|
virCommandFree(cmd);
|
||||||
VIR_FORCE_CLOSE(logfile);
|
VIR_FORCE_CLOSE(logfile);
|
||||||
virObjectUnref(cfg);
|
virObjectUnref(cfg);
|
||||||
virObjectUnref(caps);
|
virObjectUnref(caps);
|
||||||
VIR_FREE(nicindexes);
|
VIR_FREE(nicindexes);
|
||||||
|
return ret;
|
||||||
return 0;
|
|
||||||
|
|
||||||
error:
|
error:
|
||||||
/* We jump here if we failed to start the VM for any reason, or
|
/* We jump here if we failed to start the VM for any reason, or
|
||||||
@ -5109,16 +5112,10 @@ int qemuProcessStart(virConnectPtr conn,
|
|||||||
* pretend we never started it */
|
* pretend we never started it */
|
||||||
VIR_FREE(tmppath);
|
VIR_FREE(tmppath);
|
||||||
VIR_FREE(nodeset);
|
VIR_FREE(nodeset);
|
||||||
virCommandFree(cmd);
|
|
||||||
VIR_FORCE_CLOSE(logfile);
|
|
||||||
if (priv->mon)
|
if (priv->mon)
|
||||||
qemuMonitorSetDomainLog(priv->mon, -1);
|
qemuMonitorSetDomainLog(priv->mon, -1);
|
||||||
qemuProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_FAILED, stop_flags);
|
qemuProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_FAILED, stop_flags);
|
||||||
virObjectUnref(cfg);
|
goto cleanup;
|
||||||
virObjectUnref(caps);
|
|
||||||
VIR_FREE(nicindexes);
|
|
||||||
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
exit_monitor:
|
exit_monitor:
|
||||||
ignore_value(qemuDomainObjExitMonitor(driver, vm));
|
ignore_value(qemuDomainObjExitMonitor(driver, vm));
|
||||||
|
Loading…
Reference in New Issue
Block a user