[PATCH] qemu: Split shmem preparation as it's supposed to be

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

 



Since the introduction of shmem, there was a split of preparation code
from the formatting code from qemuBuildCommandLine() into
qemuProcessPrepareDomain().  Let's fix shmem in this regard, so that
we can slowly get to a cleaner codebase.

Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx>
---
 src/qemu/qemu_command.c | 30 +++++-------------------------
 src/qemu/qemu_process.c |  5 +++++
 2 files changed, 10 insertions(+), 25 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index d14bb621148d..90471d89eb8c 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -8876,28 +8876,6 @@ qemuBuildShmemDevStr(virDomainDefPtr def,
     return virBufferContentAndReset(&buf);
 }
 
-static char *
-qemuBuildShmemBackendChrStr(virLogManagerPtr logManager,
-                            virCommandPtr cmd,
-                            virQEMUDriverConfigPtr cfg,
-                            virDomainDefPtr def,
-                            virDomainShmemDefPtr shmem,
-                            virQEMUCapsPtr qemuCaps,
-                            bool chardevStdioLogd)
-{
-    char *devstr = NULL;
-
-    if (qemuDomainPrepareShmemChardev(shmem) < 0)
-        return NULL;
-
-    devstr = qemuBuildChrChardevStr(logManager, cmd, cfg, def,
-                                    &shmem->server.chr,
-                                    shmem->info.alias, qemuCaps, true,
-                                    chardevStdioLogd);
-
-    return devstr;
-}
-
 
 virJSONValuePtr
 qemuBuildShmemBackendMemProps(virDomainShmemDefPtr shmem)
@@ -9007,9 +8985,11 @@ qemuBuildShmemCommandLine(virLogManagerPtr logManager,
     VIR_FREE(devstr);
 
     if (shmem->server.enabled) {
-        if (!(devstr = qemuBuildShmemBackendChrStr(logManager, cmd, cfg, def,
-                                                   shmem, qemuCaps,
-                                                   chardevStdioLogd)))
+        devstr = qemuBuildChrChardevStr(logManager, cmd, cfg, def,
+                                        &shmem->server.chr,
+                                        shmem->info.alias, qemuCaps, true,
+                                        chardevStdioLogd);
+        if (!devstr)
             return -1;
 
         virCommandAddArgList(cmd, "-chardev", devstr, NULL);
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 525521aaf0ca..b2e1314a3887 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -5325,6 +5325,11 @@ qemuProcessPrepareDomain(virConnectPtr conn,
     if (qemuProcessUpdateGuestCPU(vm->def, priv->qemuCaps, caps, flags) < 0)
         goto cleanup;
 
+    for (i = 0; i < vm->def->nshmems; i++) {
+        if (qemuDomainPrepareShmemChardev(vm->def->shmems[i]) < 0)
+            goto cleanup;
+    }
+
     ret = 0;
  cleanup:
     virObjectUnref(caps);
-- 
2.13.3

--
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]
  Powered by Linux