mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-01 17:35:17 +00: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:
parent
ab966b9d31
commit
e204f8e516
@ -548,17 +548,11 @@ testCompareXMLToArgvValidateSchemaCommand(GStrv args,
|
|||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
testCompareXMLToArgvValidateSchema(virQEMUDriver *drv,
|
testCompareXMLToArgvValidateSchema(virCommand *cmd,
|
||||||
const char *migrateURI,
|
struct testQemuInfo *info)
|
||||||
struct testQemuInfo *info,
|
|
||||||
unsigned int flags)
|
|
||||||
{
|
{
|
||||||
g_auto(GStrv) args = NULL;
|
g_auto(GStrv) args = NULL;
|
||||||
g_autoptr(virDomainObj) vm = NULL;
|
|
||||||
qemuDomainObjPrivate *priv = NULL;
|
|
||||||
GHashTable *schema = 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
|
/* comment out with line comment to enable schema checking for non _CAPS tests
|
||||||
if (!info->schemafile)
|
if (!info->schemafile)
|
||||||
@ -580,23 +574,6 @@ testCompareXMLToArgvValidateSchema(virQEMUDriver *drv,
|
|||||||
if (!schema)
|
if (!schema)
|
||||||
return 0;
|
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)
|
if (virCommandGetArgList(cmd, &args) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@ -762,7 +739,7 @@ testCompareXMLToArgv(const void *data)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (testCompareXMLToArgvValidateSchema(&driver, migrateURI, info, flags) < 0)
|
if (testCompareXMLToArgvValidateSchema(cmd, info) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (virCommandToStringBuf(cmd, &actualBuf, true, false) < 0)
|
if (virCommandToStringBuf(cmd, &actualBuf, true, false) < 0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user