mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
qemublocktest: Extract schema root for blockdev-add validation
Move lookup of the schema root earlier so that multiple functions can use it for validation. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
1262cdede4
commit
218ce53069
@ -868,6 +868,7 @@ mymain(void)
|
|||||||
char *capslatest_x86_64 = NULL;
|
char *capslatest_x86_64 = NULL;
|
||||||
virQEMUCapsPtr caps_x86_64 = NULL;
|
virQEMUCapsPtr caps_x86_64 = NULL;
|
||||||
g_autoptr(virHashTable) qmp_schema_x86_64 = NULL;
|
g_autoptr(virHashTable) qmp_schema_x86_64 = NULL;
|
||||||
|
virJSONValuePtr qmp_schemaroot_x86_64_blockdev_add = NULL;
|
||||||
g_autoptr(virStorageSource) bitmapSourceChain = NULL;
|
g_autoptr(virStorageSource) bitmapSourceChain = NULL;
|
||||||
|
|
||||||
if (qemuTestDriverInit(&driver) < 0)
|
if (qemuTestDriverInit(&driver) < 0)
|
||||||
@ -895,6 +896,15 @@ mymain(void)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (virQEMUQAPISchemaPathGet("blockdev-add/arg-type",
|
||||||
|
qmp_schema_x86_64,
|
||||||
|
&qmp_schemaroot_x86_64_blockdev_add) < 0 ||
|
||||||
|
!qmp_schemaroot_x86_64_blockdev_add) {
|
||||||
|
VIR_TEST_VERBOSE("failed to find schema entry for blockdev-add");
|
||||||
|
ret = -1;
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
virTestCounterReset("qemu storage source xml->json->xml ");
|
virTestCounterReset("qemu storage source xml->json->xml ");
|
||||||
|
|
||||||
#define TEST_JSON_FORMAT(tpe, xmlstr) \
|
#define TEST_JSON_FORMAT(tpe, xmlstr) \
|
||||||
@ -994,15 +1004,7 @@ mymain(void)
|
|||||||
#define TEST_DISK_TO_JSON(nme) TEST_DISK_TO_JSON_FULL(nme, false)
|
#define TEST_DISK_TO_JSON(nme) TEST_DISK_TO_JSON_FULL(nme, false)
|
||||||
|
|
||||||
diskxmljsondata.schema = qmp_schema_x86_64;
|
diskxmljsondata.schema = qmp_schema_x86_64;
|
||||||
|
diskxmljsondata.schemaroot = qmp_schemaroot_x86_64_blockdev_add;
|
||||||
if (virQEMUQAPISchemaPathGet("blockdev-add/arg-type",
|
|
||||||
diskxmljsondata.schema,
|
|
||||||
&diskxmljsondata.schemaroot) < 0 ||
|
|
||||||
!diskxmljsondata.schemaroot) {
|
|
||||||
VIR_TEST_VERBOSE("failed to find schema entry for blockdev-add");
|
|
||||||
ret = -1;
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_DISK_TO_JSON_FULL("nodename-long-format", true);
|
TEST_DISK_TO_JSON_FULL("nodename-long-format", true);
|
||||||
TEST_DISK_TO_JSON_FULL("nodename-long-protocol", true);
|
TEST_DISK_TO_JSON_FULL("nodename-long-protocol", true);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user