render / rpms / libvirt

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