Blame SOURCES/libvirt-qemublocktest-Extract-schema-root-for-blockdev-add-validation.patch

a41c76
From fbeabd58626de924d59891338dade4f56044a3cc Mon Sep 17 00:00:00 2001
a41c76
Message-Id: <fbeabd58626de924d59891338dade4f56044a3cc@dist-git>
a41c76
From: Peter Krempa <pkrempa@redhat.com>
a41c76
Date: Mon, 16 Mar 2020 22:12:10 +0100
a41c76
Subject: [PATCH] qemublocktest: Extract schema root for blockdev-add
a41c76
 validation
a41c76
MIME-Version: 1.0
a41c76
Content-Type: text/plain; charset=UTF-8
a41c76
Content-Transfer-Encoding: 8bit
a41c76
a41c76
Move lookup of the schema root earlier so that multiple functions
a41c76
can use it for validation.
a41c76
a41c76
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
a41c76
Reviewed-by: Ján Tomko <jtomko@redhat.com>
a41c76
(cherry picked from commit 218ce53069b730daa508a4a67d8640b415d69b4e)
a41c76
https://bugzilla.redhat.com/show_bug.cgi?id=1804750
a41c76
Message-Id: <9f33cec13b55e431b1144042ddcbeb7afefcf969.1584391727.git.pkrempa@redhat.com>
a41c76
Reviewed-by: Ján Tomko <jtomko@redhat.com>
a41c76
---
a41c76
 tests/qemublocktest.c | 20 +++++++++++---------
a41c76
 1 file changed, 11 insertions(+), 9 deletions(-)
a41c76
a41c76
diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c
a41c76
index f805265c93..94f20eeb47 100644
a41c76
--- a/tests/qemublocktest.c
a41c76
+++ b/tests/qemublocktest.c
a41c76
@@ -864,6 +864,7 @@ mymain(void)
a41c76
     char *capslatest_x86_64 = NULL;
a41c76
     virQEMUCapsPtr caps_x86_64 = NULL;
a41c76
     g_autoptr(virHashTable) qmp_schema_x86_64 = NULL;
a41c76
+    virJSONValuePtr qmp_schemaroot_x86_64_blockdev_add = NULL;
a41c76
     g_autoptr(virStorageSource) bitmapSourceChain = NULL;
a41c76
 
a41c76
     if (qemuTestDriverInit(&driver) < 0)
a41c76
@@ -891,6 +892,15 @@ mymain(void)
a41c76
         goto cleanup;
a41c76
     }
a41c76
 
a41c76
+    if (virQEMUQAPISchemaPathGet("blockdev-add/arg-type",
a41c76
+                                 qmp_schema_x86_64,
a41c76
+                                 &qmp_schemaroot_x86_64_blockdev_add) < 0 ||
a41c76
+        !qmp_schemaroot_x86_64_blockdev_add) {
a41c76
+        VIR_TEST_VERBOSE("failed to find schema entry for blockdev-add");
a41c76
+        ret = -1;
a41c76
+        goto cleanup;
a41c76
+    }
a41c76
+
a41c76
     virTestCounterReset("qemu storage source xml->json->xml ");
a41c76
 
a41c76
 #define TEST_JSON_FORMAT(tpe, xmlstr) \
a41c76
@@ -990,15 +1000,7 @@ mymain(void)
a41c76
 #define TEST_DISK_TO_JSON(nme) TEST_DISK_TO_JSON_FULL(nme, false)
a41c76
 
a41c76
     diskxmljsondata.schema = qmp_schema_x86_64;
a41c76
-
a41c76
-    if (virQEMUQAPISchemaPathGet("blockdev-add/arg-type",
a41c76
-                                 diskxmljsondata.schema,
a41c76
-                                 &diskxmljsondata.schemaroot) < 0 ||
a41c76
-        !diskxmljsondata.schemaroot) {
a41c76
-        VIR_TEST_VERBOSE("failed to find schema entry for blockdev-add");
a41c76
-        ret = -1;
a41c76
-        goto cleanup;
a41c76
-    }
a41c76
+    diskxmljsondata.schemaroot = qmp_schemaroot_x86_64_blockdev_add;
a41c76
 
a41c76
     TEST_DISK_TO_JSON_FULL("nodename-long-format", true);
a41c76
     TEST_DISK_TO_JSON_FULL("nodename-long-protocol", true);
a41c76
-- 
a41c76
2.25.1
a41c76