1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-01-11 09:17:52 +03:00

qemuxml2argvtest: Don't re-parse and re-generate commandline for QAPI schema validation

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@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
Peter Krempa 2022-10-19 17:10:45 +02:00
parent ab966b9d31
commit e204f8e516

View File

@ -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)