render / rpms / libvirt

Forked from rpms/libvirt 4 months ago
Clone
fbe740
From e0454c4801452c031856681c68bf5d154440bbb0 Mon Sep 17 00:00:00 2001
fbe740
Message-Id: <e0454c4801452c031856681c68bf5d154440bbb0@dist-git>
fbe740
From: Peter Krempa <pkrempa@redhat.com>
fbe740
Date: Mon, 16 Mar 2020 22:12:09 +0100
fbe740
Subject: [PATCH] qemublocktest: Load QMP schema earlier
fbe740
MIME-Version: 1.0
fbe740
Content-Type: text/plain; charset=UTF-8
fbe740
Content-Transfer-Encoding: 8bit
fbe740
fbe740
Multiple tests require the schema. Extract the loading into a separate
fbe740
variable to avoid issues with ownership of the pointer.
fbe740
fbe740
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
fbe740
Reviewed-by: Ján Tomko <jtomko@redhat.com>
fbe740
(cherry picked from commit 1262cdede447a2566b6e8cb99434b767a4ef67da)
fbe740
fbe740
 Conflicts:
fbe740
	tests/qemublocktest.c
fbe740
        QMP schema loading for non-x86_64 qemus was not backported.
fbe740
fbe740
https://bugzilla.redhat.com/show_bug.cgi?id=1804750
fbe740
Message-Id: <d8a7b2d9987175b106363d781df23d313a02d870.1584391727.git.pkrempa@redhat.com>
fbe740
Reviewed-by: Ján Tomko <jtomko@redhat.com>
fbe740
---
fbe740
 tests/qemublocktest.c | 16 ++++++++++------
fbe740
 1 file changed, 10 insertions(+), 6 deletions(-)
fbe740
fbe740
diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c
fbe740
index 3057db6930..f805265c93 100644
fbe740
--- a/tests/qemublocktest.c
fbe740
+++ b/tests/qemublocktest.c
fbe740
@@ -863,6 +863,7 @@ mymain(void)
fbe740
     struct testQemuBlockBitmapBlockcopyData blockbitmapblockcopydata;
fbe740
     char *capslatest_x86_64 = NULL;
fbe740
     virQEMUCapsPtr caps_x86_64 = NULL;
fbe740
+    g_autoptr(virHashTable) qmp_schema_x86_64 = NULL;
fbe740
     g_autoptr(virStorageSource) bitmapSourceChain = NULL;
fbe740
 
fbe740
     if (qemuTestDriverInit(&driver) < 0)
fbe740
@@ -885,6 +886,11 @@ mymain(void)
fbe740
     diskxmljsondata.qemuCaps = caps_x86_64;
fbe740
     imagecreatedata.qemuCaps = caps_x86_64;
fbe740
 
fbe740
+    if (!(qmp_schema_x86_64 = testQEMUSchemaLoad())) {
fbe740
+        ret = -1;
fbe740
+        goto cleanup;
fbe740
+    }
fbe740
+
fbe740
     virTestCounterReset("qemu storage source xml->json->xml ");
fbe740
 
fbe740
 #define TEST_JSON_FORMAT(tpe, xmlstr) \
fbe740
@@ -983,10 +989,7 @@ mymain(void)
fbe740
 
fbe740
 #define TEST_DISK_TO_JSON(nme) TEST_DISK_TO_JSON_FULL(nme, false)
fbe740
 
fbe740
-    if (!(diskxmljsondata.schema = testQEMUSchemaLoad())) {
fbe740
-        ret = -1;
fbe740
-        goto cleanup;
fbe740
-    }
fbe740
+    diskxmljsondata.schema = qmp_schema_x86_64;
fbe740
 
fbe740
     if (virQEMUQAPISchemaPathGet("blockdev-add/arg-type",
fbe740
                                  diskxmljsondata.schema,
fbe740
@@ -1045,7 +1048,9 @@ mymain(void)
fbe740
                        &imagecreatedata) < 0) \
fbe740
             ret = -1; \
fbe740
     } while (0)
fbe740
-    imagecreatedata.schema = diskxmljsondata.schema;
fbe740
+
fbe740
+    imagecreatedata.schema = qmp_schema_x86_64;
fbe740
+
fbe740
     if (virQEMUQAPISchemaPathGet("blockdev-create/arg-type/options",
fbe740
                                  imagecreatedata.schema,
fbe740
                                  &imagecreatedata.schemaroot) < 0 ||
fbe740
@@ -1198,7 +1203,6 @@ mymain(void)
fbe740
     TEST_BITMAP_BLOCKCOPY("snapshots-deep", false, "snapshots");
fbe740
 
fbe740
  cleanup:
fbe740
-    virHashFree(diskxmljsondata.schema);
fbe740
     qemuTestDriverFree(&driver);
fbe740
     VIR_FREE(capslatest_x86_64);
fbe740
     virObjectUnref(caps_x86_64);
fbe740
-- 
fbe740
2.25.1
fbe740