render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
127bba
From 2bcbf4e9a10d8db84c212c7815456af6996bc6e9 Mon Sep 17 00:00:00 2001
127bba
Message-Id: <2bcbf4e9a10d8db84c212c7815456af6996bc6e9@dist-git>
127bba
From: Martin Kletzander <mkletzan@redhat.com>
127bba
Date: Fri, 4 Nov 2016 10:29:41 +0100
127bba
Subject: [PATCH] qemu: Abstract shmem socket path preparation
127bba
127bba
Put it into qemuDomainPrepareShmemChardev() so it can be used later.
127bba
Also don't fill in the path unless the server option is enabled.
127bba
127bba
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
127bba
(cherry picked from commit 0f61d7b5f2b5d011b58386e7bf1a48f75a15e9d7)
127bba
127bba
https://bugzilla.redhat.com/show_bug.cgi?id=1392031
127bba
127bba
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
127bba
---
127bba
 src/qemu/qemu_command.c |  5 +----
127bba
 src/qemu/qemu_domain.c  | 13 +++++++++++++
127bba
 src/qemu/qemu_domain.h  |  3 +++
127bba
 3 files changed, 17 insertions(+), 4 deletions(-)
127bba
127bba
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
127bba
index 3ebfe84..adb743b 100644
127bba
--- a/src/qemu/qemu_command.c
127bba
+++ b/src/qemu/qemu_command.c
127bba
@@ -8513,10 +8513,7 @@ qemuBuildShmemBackendStr(virLogManagerPtr logManager,
127bba
 {
127bba
     char *devstr = NULL;
127bba
 
127bba
-    if (!shmem->server.chr.data.nix.path &&
127bba
-        virAsprintf(&shmem->server.chr.data.nix.path,
127bba
-                    "/var/lib/libvirt/shmem-%s-sock",
127bba
-                    shmem->name) < 0)
127bba
+    if (qemuDomainPrepareShmemChardev(shmem) < 0)
127bba
         return NULL;
127bba
 
127bba
     devstr = qemuBuildChrChardevStr(logManager, cmd, cfg, def,
127bba
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
127bba
index 8db2ed5..4f99c14 100644
127bba
--- a/src/qemu/qemu_domain.c
127bba
+++ b/src/qemu/qemu_domain.c
127bba
@@ -5993,6 +5993,19 @@ qemuDomainPrepareChannel(virDomainChrDefPtr channel,
127bba
 }
127bba
 
127bba
 
127bba
+int
127bba
+qemuDomainPrepareShmemChardev(virDomainShmemDefPtr shmem)
127bba
+{
127bba
+    if (!shmem->server.enabled ||
127bba
+        shmem->server.chr.data.nix.path)
127bba
+        return 0;
127bba
+
127bba
+    return virAsprintf(&shmem->server.chr.data.nix.path,
127bba
+                       "/var/lib/libvirt/shmem-%s-sock",
127bba
+                       shmem->name);
127bba
+}
127bba
+
127bba
+
127bba
 /**
127bba
  * qemuDomainVcpuHotplugIsInOrder:
127bba
  * @def: domain definition
127bba
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
127bba
index f94bfc9..66ffe58 100644
127bba
--- a/src/qemu/qemu_domain.h
127bba
+++ b/src/qemu/qemu_domain.h
127bba
@@ -724,6 +724,9 @@ int qemuDomainPrepareChannel(virDomainChrDefPtr chr,
127bba
                              const char *domainChannelTargetDir)
127bba
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
127bba
 
127bba
+int qemuDomainPrepareShmemChardev(virDomainShmemDefPtr shmem)
127bba
+    ATTRIBUTE_NONNULL(1);
127bba
+
127bba
 bool qemuDomainVcpuHotplugIsInOrder(virDomainDefPtr def)
127bba
     ATTRIBUTE_NONNULL(1);
127bba
 
127bba
-- 
127bba
2.10.2
127bba