render / rpms / libvirt

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