]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu_process: Store libDir in qemuProcessQMP struct
authorChris Venteicher <cventeic@redhat.com>
Sun, 13 Jan 2019 00:50:12 +0000 (18:50 -0600)
committerJiri Denemark <jdenemar@redhat.com>
Tue, 19 Feb 2019 17:44:01 +0000 (18:44 +0100)
Store libDir path in the qemuProcessQMP struct in anticipation of moving
path construction code into qemuProcessQMPInit function.

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
src/qemu/qemu_process.h

index 85079c8c1547898cc3120b6364194165eb234b2a..c4cbd7c8073fd1586495f370bbc9d46e3a35f78e 100644 (file)
@@ -8332,6 +8332,7 @@ qemuProcessQMPFree(qemuProcessQMPPtr proc)
 
     qemuProcessQMPStop(proc);
     VIR_FREE(proc->binary);
+    VIR_FREE(proc->libDir);
     VIR_FREE(proc->monpath);
     VIR_FREE(proc->monarg);
     VIR_FREE(proc->pidfile);
@@ -8352,7 +8353,8 @@ qemuProcessQMPNew(const char *binary,
     if (VIR_ALLOC(proc) < 0)
         goto error;
 
-    if (VIR_STRDUP(proc->binary, binary) < 0)
+    if (VIR_STRDUP(proc->binary, binary) < 0 ||
+        VIR_STRDUP(proc->libDir, libDir) < 0)
         goto error;
 
     proc->runUid = runUid;
@@ -8362,7 +8364,7 @@ qemuProcessQMPNew(const char *binary,
     /* the ".sock" sufix is important to avoid a possible clash with a qemu
      * domain called "capabilities"
      */
-    if (virAsprintf(&proc->monpath, "%s/%s", libDir,
+    if (virAsprintf(&proc->monpath, "%s/%s", proc->libDir,
                     "capabilities.monitor.sock") < 0)
         goto error;
     if (virAsprintf(&proc->monarg, "unix:%s,server,nowait", proc->monpath) < 0)
@@ -8374,7 +8376,7 @@ qemuProcessQMPNew(const char *binary,
      * -daemonize we need QEMU to be allowed to create them, rather
      * than libvirtd. So we're using libDir which QEMU can write to
      */
-    if (virAsprintf(&proc->pidfile, "%s/%s", libDir, "capabilities.pidfile") < 0)
+    if (virAsprintf(&proc->pidfile, "%s/%s", proc->libDir, "capabilities.pidfile") < 0)
         goto error;
 
     virPidFileForceCleanupPath(proc->pidfile);
index c075ae64457e89f59fac3dea6a68dc87f92a84ed..9ab885c6c3e8f77e6075bb0747cc19d913010a0c 100644 (file)
@@ -218,6 +218,7 @@ typedef struct _qemuProcessQMP qemuProcessQMP;
 typedef qemuProcessQMP *qemuProcessQMPPtr;
 struct _qemuProcessQMP {
     char *binary;
+    char *libDir;
     uid_t runUid;
     gid_t runGid;
     char *stderr;