]> xenbits.xensource.com Git - libvirt.git/commitdiff
tests: Use 'format' layer nodename accessors in test code
authorPeter Krempa <pkrempa@redhat.com>
Mon, 16 Oct 2023 13:55:25 +0000 (15:55 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 17 Oct 2023 12:16:17 +0000 (14:16 +0200)
The test code cares mostly about the actual layer nodenames thus,
appropriate accessors are used.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
tests/qemublocktest.c
tests/qemumonitorjsontest.c

index 9a72a67ce2365bcc17b1b59d4b136ef22941ccb2..addd6460717aa2140ddd19598726342ba306de92 100644 (file)
@@ -241,7 +241,7 @@ testQemuDiskXMLToJSONFakeSecrets(virStorageSource *src)
         srcpriv->encinfo[0] = g_new0(qemuDomainSecretInfo, 1);
 
         srcpriv->encinfo[0]->alias = g_strdup_printf("%s-encalias",
-                                                     NULLSTR(src->nodeformat));
+                                                     qemuBlockStorageSourceGetFormatNodename(src));
         srcpriv->enccount = 1;
     }
 
@@ -653,7 +653,7 @@ testQemuBitmapListPrint(const char *title,
 
     for (; next; next = next->next) {
         virStorageSource *src = next->data;
-        virBufferAsprintf(buf, "%s\n", src->nodeformat);
+        virBufferAsprintf(buf, "%s\n", qemuBlockStorageSourceGetFormatNodename(src));
     }
 }
 
@@ -668,7 +668,7 @@ testQemuBackupIncrementalBitmapCalculateGetFakeImage(size_t idx)
    ret->format = VIR_STORAGE_FILE_QCOW2;
    ret->path = g_strdup_printf("/image%zu", idx);
    qemuBlockStorageSourceSetStorageNodename(ret, g_strdup_printf("libvirt-%zu-storage", idx));
-   ret->nodeformat = g_strdup_printf("libvirt-%zu-format", idx);
+   qemuBlockStorageSourceSetFormatNodename(ret, g_strdup_printf("libvirt-%zu-format", idx));
 
    return ret;
 }
@@ -741,7 +741,7 @@ testQemuBackupIncrementalBitmapCalculate(const void *opaque)
     }
 
     target = virStorageSourceNew();
-    target->nodeformat = g_strdup_printf("target_node");
+    qemuBlockStorageSourceSetFormatNodename(target, g_strdup_printf("target_node"));
 
     if (qemuBackupDiskPrepareOneBitmapsChain(data->chain,
                                              target,
@@ -872,7 +872,7 @@ testQemuBlockBitmapBlockcopy(const void *opaque)
     g_autoptr(virStorageSource) fakemirror = virStorageSourceNew();
     g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
 
-    fakemirror->nodeformat = g_strdup("mirror-format-node");
+    qemuBlockStorageSourceSetFormatNodename(fakemirror, g_strdup("mirror-format-node"));
 
     expectpath = g_strdup_printf("%s/%s%s-out.json", abs_srcdir,
                                  blockcopyPrefix, data->name);
index 6b82e3841b469c602157e5c16ac416408f7a6a85..6293b416bd433389825d6c53ef6550018b7e2001 100644 (file)
@@ -2600,7 +2600,7 @@ testQemuMonitorJSONBlockdevReopen(const void *opaque)
 
     src->format = VIR_STORAGE_FILE_QCOW2;
     src->readonly = true;
-    src->nodeformat = g_strdup("test node");
+    qemuBlockStorageSourceSetFormatNodename(src, g_strdup("test node"));
     qemuBlockStorageSourceSetStorageNodename(src, g_strdup("backing nodename"));
     src->backingStore = virStorageSourceNew();