[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH RFC 12/22] qemu_process: Store libDir in qemuProcess struct



Store libDir path in the qemuProcess struct in anticipation of moving
path construction code into qemuProcessInitQmp function.

Signed-off-by: Chris Venteicher <cventeic redhat com>
---
 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 fe4361ed5d..0b96debf25 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -8088,6 +8088,7 @@ qemuProcessFree(qemuProcessPtr proc)
 
     qemuProcessStopQmp(proc);
     VIR_FREE(proc->binary);
+    VIR_FREE(proc->libDir);
     VIR_FREE(proc->monpath);
     VIR_FREE(proc->monarg);
     VIR_FREE(proc->pidfile);
@@ -8108,7 +8109,8 @@ qemuProcessNew(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->forceTCG = forceTCG;
@@ -8119,7 +8121,7 @@ qemuProcessNew(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)
@@ -8131,7 +8133,7 @@ qemuProcessNew(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 c34ca52ef5..1b8f743861 100644
--- a/src/qemu/qemu_process.h
+++ b/src/qemu/qemu_process.h
@@ -218,6 +218,7 @@ typedef struct _qemuProcess qemuProcess;
 typedef qemuProcess *qemuProcessPtr;
 struct _qemuProcess {
     char *binary;
+    char *libDir;
     uid_t runUid;
     gid_t runGid;
     char *qmperr;  /* qemu process stderr */
-- 
2.17.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]