[PATCH 08/18] qemu: migration_cookie: Replace virJSONValueObjectCreate by virJSONValueObjectAdd

Peter Krempa pkrempa at redhat.com
Mon Nov 15 14:22:07 UTC 2021


virJSONValueObjectAdd now works identically to virJSONValueObjectCreate
when used with a NULL argument. Replace all callers.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/qemu/qemu_migration_cookie.c | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/src/qemu/qemu_migration_cookie.c b/src/qemu/qemu_migration_cookie.c
index cc4cc39b32..eaf360932d 100644
--- a/src/qemu/qemu_migration_cookie.c
+++ b/src/qemu/qemu_migration_cookie.c
@@ -1623,16 +1623,17 @@ qemuMigrationCookieBlockDirtyBitmapsToParams(GSList *disks,
                 bitmapname = bitmap->bitmapname;

             if (bitmap->persistent == VIR_TRISTATE_BOOL_YES) {
-                if (virJSONValueObjectCreate(&transform,
-                                             "b:persistent", true, NULL) < 0)
+                if (virJSONValueObjectAdd(&transform,
+                                          "b:persistent", true,
+                                          NULL) < 0)
                     return -1;
             }

-            if (virJSONValueObjectCreate(&jsonbitmap,
-                                         "s:name", bitmapname,
-                                         "s:alias", bitmap->alias,
-                                         "A:transform", &transform,
-                                         NULL) < 0)
+            if (virJSONValueObjectAdd(&jsonbitmap,
+                                      "s:name", bitmapname,
+                                      "s:alias", bitmap->alias,
+                                      "A:transform", &transform,
+                                      NULL) < 0)
                 return -1;

             if (virJSONValueArrayAppend(jsonbitmaps, &jsonbitmap) < 0)
@@ -1644,11 +1645,11 @@ qemuMigrationCookieBlockDirtyBitmapsToParams(GSList *disks,
         if (!hasBitmaps)
             continue;

-        if (virJSONValueObjectCreate(&jsondisk,
-                                     "s:node-name", disk->nodename,
-                                     "s:alias", disk->target,
-                                     "a:bitmaps", &jsonbitmaps,
-                                     NULL) < 0)
+        if (virJSONValueObjectAdd(&jsondisk,
+                                  "s:node-name", disk->nodename,
+                                  "s:alias", disk->target,
+                                  "a:bitmaps", &jsonbitmaps,
+                                  NULL) < 0)
             return -1;

         if (virJSONValueArrayAppend(map, &jsondisk) < 0)
-- 
2.31.1




More information about the libvir-list mailing list