Move code for setting paths and prepping file system from
qemuProcessQmpNew to qemuProcessQmpInit.
This keeps qemuProcessQmpNew limited to data structures
and path initialization is done in qemuProcessQmpInit.
The patch is a non-functional, cut / paste change,
however goto is now "cleanup" rather than "error".
Signed-off-by: Chris Venteicher <cventeic(a)redhat.com>
---
src/qemu/qemu_process.c | 46 +++++++++++++++++++++--------------------
1 file changed, 24 insertions(+), 22 deletions(-)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index d4025ac1bc..fc15cb1a3c 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -8145,14 +8145,34 @@ qemuProcessQmpNew(const char *binary,
proc->runGid = runGid;
proc->forceTCG = forceTCG;
+ return proc;
+
+ error:
+ qemuProcessQmpFree(proc);
+ return NULL;
+}
+
+
+/* Initialize configuration and paths prior to starting QEMU
+ */
+static int
+qemuProcessQmpInit(qemuProcessQmpPtr proc)
+{
+ int ret = -1;
+
+ VIR_DEBUG("Beginning VM startup process"
+ " proc=%p, emulator=%s",
+ proc, proc->binary);
+
/* the ".sock" sufix is important to avoid a possible clash with a qemu
* domain called "capabilities"
*/
if (virAsprintf(&proc->monpath, "%s/%s", proc->libDir,
"capabilities.monitor.sock") < 0)
- goto error;
+ goto cleanup;
+
if (virAsprintf(&proc->monarg, "unix:%s,server,nowait",
proc->monpath) < 0)
- goto error;
+ goto cleanup;
/* ".pidfile" suffix is used rather than ".pid" to avoid a
possible clash
* with a qemu domain called "capabilities"
@@ -8161,31 +8181,13 @@ qemuProcessQmpNew(const char *binary,
* than libvirtd. So we're using libDir which QEMU can write to
*/
if (virAsprintf(&proc->pidfile, "%s/%s", proc->libDir,
"capabilities.pidfile") < 0)
- goto error;
+ goto cleanup;
virPidFileForceCleanupPath(proc->pidfile);
- return proc;
-
- error:
- qemuProcessQmpFree(proc);
- return NULL;
-}
-
-
-/* Initialize configuration and paths prior to starting QEMU
- */
-static int
-qemuProcessQmpInit(qemuProcessQmpPtr proc)
-{
- int ret = -1;
-
- VIR_DEBUG("Beginning VM startup process"
- " proc=%p, emulator=%s",
- proc, proc->binary);
-
ret = 0;
+ cleanup:
VIR_DEBUG("ret=%i", ret);
return ret;
}
--
2.17.1