[PATCH 2/4] qemuBuildHostNetStr: do not start options with a comma

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

 



Put the comma at the end and trim it later for consistency.
---
 src/qemu/qemu_command.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index eba7ba9..80ebe51 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3742,19 +3742,18 @@ qemuBuildHostNetStr(virDomainNetDefPtr net,
     }
 
     if (vlan >= 0) {
-        virBufferAsprintf(&buf, "vlan=%d", vlan);
+        virBufferAsprintf(&buf, "vlan=%d,", vlan);
         if (net->info.alias)
-            virBufferAsprintf(&buf, ",name=host%s",
-                              net->info.alias);
+            virBufferAsprintf(&buf, "name=host%s,", net->info.alias);
     } else {
-        virBufferAsprintf(&buf, "id=host%s", net->info.alias);
+        virBufferAsprintf(&buf, "id=host%s,", net->info.alias);
     }
 
     if (is_tap) {
         if (vhostfdSize) {
-            virBufferAddLit(&buf, ",vhost=on,");
+            virBufferAddLit(&buf, "vhost=on,");
             if (vhostfdSize == 1) {
-                virBufferAsprintf(&buf, "vhostfd=%s", vhostfd[0]);
+                virBufferAsprintf(&buf, "vhostfd=%s,", vhostfd[0]);
             } else {
                 virBufferAddLit(&buf, "vhostfds=");
                 for (i = 0; i < vhostfdSize; i++) {
@@ -3762,14 +3761,16 @@ qemuBuildHostNetStr(virDomainNetDefPtr net,
                         virBufferAddChar(&buf, ':');
                     virBufferAdd(&buf, vhostfd[i], -1);
                 }
+                virBufferAddChar(&buf, ',');
             }
         }
         if (net->tune.sndbuf_specified)
-            virBufferAsprintf(&buf, ",sndbuf=%lu", net->tune.sndbuf);
+            virBufferAsprintf(&buf, "sndbuf=%lu,", net->tune.sndbuf);
     }
 
     virObjectUnref(cfg);
 
+    virBufferTrim(&buf, ",", -1);
     if (virBufferCheckError(&buf) < 0)
         return NULL;
 
-- 
2.7.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]