[libvirt] [PATCH 14/20] qemu_process: Store libDir in qemuProcessQMP struct

Jiri Denemark jdenemar at redhat.com
Tue Feb 19 09:04:57 UTC 2019


From: Chris Venteicher <cventeic at redhat.com>

Store libDir path in the qemuProcessQMP struct in anticipation of moving
path construction code into qemuProcessQMPInit function.

Signed-off-by: Chris Venteicher <cventeic at redhat.com>
Reviewed-by: Jiri Denemark <jdenemar at redhat.com>
Signed-off-by: Jiri Denemark <jdenemar at redhat.com>
---

Notes:
    Version 7:
    - no change

 src/qemu/qemu_process.c | 8 +++++---
 src/qemu/qemu_process.h | 1 +
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 85079c8c15..c4cbd7c807 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -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);
diff --git a/src/qemu/qemu_process.h b/src/qemu/qemu_process.h
index c075ae6445..9ab885c6c3 100644
--- a/src/qemu/qemu_process.h
+++ b/src/qemu/qemu_process.h
@@ -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;
-- 
2.20.1




More information about the libvir-list mailing list