[PATCH v2 09/14] qemuBuildChrChardevStr: Introduce @nowait argument

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

 



This alone makes not much sense. But the aim is to reuse this
function in qemuBuildVhostuserCommandLine() where 'nowait' is not
supported for vhost-user devices.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/qemu/qemu_command.c | 35 +++++++++++++++++++----------------
 1 file changed, 19 insertions(+), 16 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 4a67d80..71067ee 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -4934,7 +4934,8 @@ qemuBuildChrChardevStr(virLogManagerPtr logManager,
                        const virDomainDef *def,
                        const virDomainChrSourceDef *dev,
                        const char *alias,
-                       virQEMUCapsPtr qemuCaps)
+                       virQEMUCapsPtr qemuCaps,
+                       bool nowait)
 {
     virBuffer buf = VIR_BUFFER_INITIALIZER;
     bool telnet;
@@ -5007,12 +5008,14 @@ qemuBuildChrChardevStr(virLogManagerPtr logManager,
     case VIR_DOMAIN_CHR_TYPE_TCP:
         telnet = dev->data.tcp.protocol == VIR_DOMAIN_CHR_TCP_PROTOCOL_TELNET;
         virBufferAsprintf(&buf,
-                          "socket,id=char%s,host=%s,port=%s%s%s",
+                          "socket,id=char%s,host=%s,port=%s%s",
                           alias,
                           dev->data.tcp.host,
                           dev->data.tcp.service,
-                          telnet ? ",telnet" : "",
-                          dev->data.tcp.listen ? ",server,nowait" : "");
+                          telnet ? ",telnet" : "");
+
+        if (dev->data.tcp.listen)
+            virBufferAdd(&buf, nowait ? ",server,nowait" : ",server", -1);
 
         if (cfg->chardevTLS) {
             char *objalias = NULL;
@@ -5034,7 +5037,7 @@ qemuBuildChrChardevStr(virLogManagerPtr logManager,
         virBufferAsprintf(&buf, "socket,id=char%s,path=", alias);
         virQEMUBuildBufferEscapeComma(&buf, dev->data.nix.path);
         if (dev->data.nix.listen)
-            virBufferAddLit(&buf, ",server,nowait");
+            virBufferAdd(&buf, nowait ? ",server,nowait" : ",server", -1);
         break;
 
     case VIR_DOMAIN_CHR_TYPE_SPICEVMC:
@@ -5358,7 +5361,7 @@ qemuBuildMonitorCommandLine(virLogManagerPtr logManager,
 
         if (!(chrdev = qemuBuildChrChardevStr(logManager, cmd, cfg, def,
                                               monitor_chr, "monitor",
-                                              qemuCaps)))
+                                              qemuCaps, true)))
             return -1;
         virCommandAddArg(cmd, "-chardev");
         virCommandAddArg(cmd, chrdev);
@@ -5516,7 +5519,7 @@ qemuBuildRNGBackendChrdevStr(virLogManagerPtr logManager,
     case VIR_DOMAIN_RNG_BACKEND_EGD:
         if (!(*chr = qemuBuildChrChardevStr(logManager, cmd, cfg, def,
                                             rng->source.chardev,
-                                            rng->info.alias, qemuCaps)))
+                                            rng->info.alias, qemuCaps, true)))
             return -1;
     }
 
@@ -8375,7 +8378,7 @@ qemuBuildSmartcardCommandLine(virLogManagerPtr logManager,
         if (!(devstr = qemuBuildChrChardevStr(logManager, cmd, cfg, def,
                                               &smartcard->data.passthru,
                                               smartcard->info.alias,
-                                              qemuCaps))) {
+                                              qemuCaps, true))) {
             virBufferFreeAndReset(&opt);
             return -1;
         }
@@ -8464,7 +8467,7 @@ qemuBuildShmemBackendChrStr(virLogManagerPtr logManager,
 
     devstr = qemuBuildChrChardevStr(logManager, cmd, cfg, def,
                                     &shmem->server.chr,
-                                    shmem->info.alias, qemuCaps);
+                                    shmem->info.alias, qemuCaps, true);
 
     return devstr;
 }
@@ -8568,7 +8571,7 @@ qemuBuildSerialCommandLine(virLogManagerPtr logManager,
             if (!(devstr = qemuBuildChrChardevStr(logManager, cmd, cfg, def,
                                                   &serial->source,
                                                   serial->info.alias,
-                                                  qemuCaps)))
+                                                  qemuCaps, true)))
                 return -1;
             virCommandAddArg(cmd, "-chardev");
             virCommandAddArg(cmd, devstr);
@@ -8607,7 +8610,7 @@ qemuBuildParallelsCommandLine(virLogManagerPtr logManager,
             if (!(devstr = qemuBuildChrChardevStr(logManager, cmd, cfg, def,
                                                   &parallel->source,
                                                   parallel->info.alias,
-                                                  qemuCaps)))
+                                                  qemuCaps, true)))
                 return -1;
             virCommandAddArg(cmd, "-chardev");
             virCommandAddArg(cmd, devstr);
@@ -8653,7 +8656,7 @@ qemuBuildChannelsCommandLine(virLogManagerPtr logManager,
             if (!(devstr = qemuBuildChrChardevStr(logManager, cmd, cfg, def,
                                                   &channel->source,
                                                   channel->info.alias,
-                                                  qemuCaps)))
+                                                  qemuCaps, true)))
                 return -1;
             virCommandAddArg(cmd, "-chardev");
             virCommandAddArg(cmd, devstr);
@@ -8676,7 +8679,7 @@ qemuBuildChannelsCommandLine(virLogManagerPtr logManager,
                 if (!(devstr = qemuBuildChrChardevStr(logManager, cmd, cfg, def,
                                                       &channel->source,
                                                       channel->info.alias,
-                                                      qemuCaps)))
+                                                      qemuCaps, true)))
                     return -1;
                 virCommandAddArg(cmd, "-chardev");
                 virCommandAddArg(cmd, devstr);
@@ -8719,7 +8722,7 @@ qemuBuildConsoleCommandLine(virLogManagerPtr logManager,
             if (!(devstr = qemuBuildChrChardevStr(logManager, cmd, cfg, def,
                                                   &console->source,
                                                   console->info.alias,
-                                                  qemuCaps)))
+                                                  qemuCaps, true)))
                 return -1;
             virCommandAddArg(cmd, "-chardev");
             virCommandAddArg(cmd, devstr);
@@ -8733,7 +8736,7 @@ qemuBuildConsoleCommandLine(virLogManagerPtr logManager,
             if (!(devstr = qemuBuildChrChardevStr(logManager, cmd, cfg, def,
                                                   &console->source,
                                                   console->info.alias,
-                                                  qemuCaps)))
+                                                  qemuCaps, true)))
                 return -1;
             virCommandAddArg(cmd, "-chardev");
             virCommandAddArg(cmd, devstr);
@@ -8862,7 +8865,7 @@ qemuBuildRedirdevCommandLine(virLogManagerPtr logManager,
         if (!(devstr = qemuBuildChrChardevStr(logManager, cmd, cfg, def,
                                               &redirdev->source.chr,
                                               redirdev->info.alias,
-                                              qemuCaps))) {
+                                              qemuCaps, true))) {
             return -1;
         }
 
-- 
2.8.4

--
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]