]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
testCompareXMLToArgvValidateSchema: Base -netdev validation on JSON
authorPeter Krempa <pkrempa@redhat.com>
Fri, 24 Sep 2021 16:58:33 +0000 (18:58 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 12 Oct 2021 08:26:00 +0000 (10:26 +0200)
Base the validation on presence of JSON as we do with other validated
commands. This will prepare the code for a refactor so that it's the
same for all validated commands.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
tests/qemuxml2argvtest.c

index ec7bb3074ea96ff65dc5e773d7e79ac47ba0ca39..660ca4148c4c2079c952ccbe56591f07d7a67595 100644 (file)
@@ -503,7 +503,6 @@ testCompareXMLToArgvValidateSchema(virQEMUDriver *drv,
     GHashTable *schema = NULL;
     g_autoptr(virCommand) cmd = NULL;
     unsigned int parseFlags = info->parseFlags;
-    bool netdevQAPIfied = false;
 
     /* comment out with line comment to enable schema checking for non _CAPS tests
     if (!info->schemafile)
@@ -546,8 +545,6 @@ testCompareXMLToArgvValidateSchema(virQEMUDriver *drv,
     if (virCommandGetArgList(cmd, &args, &nargs) < 0)
         return -1;
 
-    netdevQAPIfied = !virQEMUQAPISchemaPathExists("netdev_add/arg-type/type/!string", schema);
-
     for (i = 0; i < nargs; i++) {
         g_auto(virBuffer) debug = VIR_BUFFER_INITIALIZER;
         g_autoptr(virJSONValue) jsonargs = NULL;
@@ -565,7 +562,7 @@ testCompareXMLToArgvValidateSchema(virQEMUDriver *drv,
 
             i++;
         } else if (STREQ(args[i], "-netdev")) {
-            if (!netdevQAPIfied) {
+            if (*args[i + 1] != '{') {
                 i++;
                 continue;
             }