[PATCH 2/7] util: Do not assume comma after object id

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

 



From: Han Han <hanhanzhiyeqianke@xxxxxxxxx>

For qemu object like rng-builtin, there are no properties after id
property. We should always set comma after object id. Otherwise it will
cause trailing comma on object:
    -object rng-builtin,id=ID,

Signed-off-by: Han Han <hhan@xxxxxxxxxx>
---
 src/util/virqemu.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/util/virqemu.c b/src/util/virqemu.c
index f3a233af..72151e43 100644
--- a/src/util/virqemu.c
+++ b/src/util/virqemu.c
@@ -239,12 +239,13 @@ virQEMUBuildObjectCommandlineFromJSONInternal(virBufferPtr buf,
         return -1;
     }
 
-    virBufferAsprintf(buf, "%s,id=%s,", type, alias);
-
-    if (props &&
-        virQEMUBuildCommandLineJSON(props, buf,
-                                    virQEMUBuildCommandLineJSONArrayBitmap) < 0)
-        return -1;
+    virBufferAsprintf(buf, "%s,id=%s", type, alias);
+    if (props) {
+        virBufferAsprintf(buf, ",");
+        if (virQEMUBuildCommandLineJSON(props, buf,
+                                virQEMUBuildCommandLineJSONArrayBitmap) < 0)
+            return -1;
+    }
 
     return 0;
 }
-- 
2.23.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]

  Powered by Linux