[PATCH 15/20] qemu: Abstract shmem socket path preparation

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

 



Put it into qemuDomainPrepareShmemChardev() so it can be used later.

Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx>
---
 src/qemu/qemu_command.c |  5 +----
 src/qemu/qemu_domain.c  | 13 +++++++++++++
 src/qemu/qemu_domain.h  |  3 +++
 3 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index fdd656e241b3..aba7dc3db79b 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -8607,10 +8607,7 @@ qemuBuildShmemBackendStr(virLogManagerPtr logManager,
 {
     char *devstr = NULL;

-    if (!shmem->server.chr.data.nix.path &&
-        virAsprintf(&shmem->server.chr.data.nix.path,
-                    "/var/lib/libvirt/shmem-%s-sock",
-                    shmem->name) < 0)
+    if (qemuDomainPrepareShmemChardev(shmem) < 0)
         return NULL;

     devstr = qemuBuildChrChardevStr(logManager, cmd, cfg, def,
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 1fdbdf68fc8b..940e216b7d1c 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -6089,6 +6089,19 @@ qemuDomainPrepareChannel(virDomainChrDefPtr channel,
 }


+int
+qemuDomainPrepareShmemChardev(virDomainShmemDefPtr shmem)
+{
+    if (!shmem->server.enabled ||
+        shmem->server.chr.data.nix.path)
+        return 0;
+
+    return virAsprintf(&shmem->server.chr.data.nix.path,
+                       "/var/lib/libvirt/shmem-%s-sock",
+                       shmem->name);
+}
+
+
 /**
  * qemuDomainVcpuHotplugIsInOrder:
  * @def: domain definition
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index a1404d037825..c2fab3ba3521 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -722,6 +722,9 @@ int qemuDomainPrepareChannel(virDomainChrDefPtr chr,
                              const char *domainChannelTargetDir)
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);

+int qemuDomainPrepareShmemChardev(virDomainShmemDefPtr shmem)
+    ATTRIBUTE_NONNULL(1);
+
 bool qemuDomainVcpuHotplugIsInOrder(virDomainDefPtr def)
     ATTRIBUTE_NONNULL(1);

-- 
2.10.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]