]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu_process: Setup paths within qemuProcessQMPInit
authorChris Venteicher <cventeic@redhat.com>
Sun, 13 Jan 2019 00:50:13 +0000 (18:50 -0600)
committerJiri Denemark <jdenemar@redhat.com>
Tue, 19 Feb 2019 17:44:05 +0000 (18:44 +0100)
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@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_process.c

index c4cbd7c8073fd1586495f370bbc9d46e3a35f78e..9341aa43a7e71cf3c8f2fc36f07e4cf17ba7ff2a 100644 (file)
@@ -8361,14 +8361,30 @@ qemuProcessQMPNew(const char *binary,
     proc->runGid = runGid;
     proc->forceTCG = forceTCG;
 
+    return proc;
+
+ error:
+    qemuProcessQMPFree(proc);
+    return NULL;
+}
+
+
+static int
+qemuProcessQMPInit(qemuProcessQMPPtr proc)
+{
+    int ret = -1;
+
+    VIR_DEBUG("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"
@@ -8377,27 +8393,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;
-}
-
-
-static int
-qemuProcessQMPInit(qemuProcessQMPPtr proc)
-{
-    int ret = -1;
-
-    VIR_DEBUG("proc=%p, emulator=%s", proc, proc->binary);
-
     ret = 0;
 
+ cleanup:
     return ret;
 }