The removal of the special internal flag for '-netdev' validatition now
allows us to use the same virCommand object for validation of the
schema.
Pass it into the validator instead of re-parsing and re-generating
everything.
This improved the runtime of qemuxml2argvtest by ~25% on my box.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
tests/qemuxml2argvtest.c | 29 +++--------------------------
1 file changed, 3 insertions(+), 26 deletions(-)
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index de69cd426a..7ede68d555 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -548,17 +548,11 @@ testCompareXMLToArgvValidateSchemaCommand(GStrv args,
static int
-testCompareXMLToArgvValidateSchema(virQEMUDriver *drv,
- const char *migrateURI,
- struct testQemuInfo *info,
- unsigned int flags)
+testCompareXMLToArgvValidateSchema(virCommand *cmd,
+ struct testQemuInfo *info)
{
g_auto(GStrv) args = NULL;
- g_autoptr(virDomainObj) vm = NULL;
- qemuDomainObjPrivate *priv = NULL;
GHashTable *schema = NULL;
- g_autoptr(virCommand) cmd = NULL;
- unsigned int parseFlags = info->parseFlags;
/* comment out with line comment to enable schema checking for non _CAPS tests
if (!info->schemafile)
@@ -580,23 +574,6 @@ testCompareXMLToArgvValidateSchema(virQEMUDriver *drv,
if (!schema)
return 0;
- if (!(vm = virDomainObjNew(driver.xmlopt)))
- return -1;
-
- parseFlags |= VIR_DOMAIN_DEF_PARSE_INACTIVE;
- if (!(vm->def = virDomainDefParseFile(info->infile,
- driver.xmlopt,
- NULL, parseFlags)))
- return -1;
-
- priv = vm->privateData;
-
- if (virBitmapParse("0-3", &priv->autoNodeset, 4) < 0)
- return -1;
-
- if (!(cmd = testCompareXMLToArgvCreateArgs(drv, vm, migrateURI, info, flags)))
- return -1;
-
if (virCommandGetArgList(cmd, &args) < 0)
return -1;
@@ -762,7 +739,7 @@ testCompareXMLToArgv(const void *data)
goto cleanup;
}
- if (testCompareXMLToArgvValidateSchema(&driver, migrateURI, info, flags) < 0)
+ if (testCompareXMLToArgvValidateSchema(cmd, info) < 0)
goto cleanup;
if (virCommandToStringBuf(cmd, &actualBuf, true, false) < 0)
--
2.37.3