if (!data->legacy) {
if (testQEMUSchemaValidate(backendprops, data->schemaroot,
- data->schema, &debug) < 0) {
+ data->schema, false, &debug) < 0) {
g_autofree char *debugmsg = virBufferContentAndReset(&debug);
g_autofree char *debugprops = virJSONValueToString(backendprops, true);
return -1;
if (testQEMUSchemaValidate(jsonsrcout, data->schemaroot,
- data->schema, &debug) < 0) {
+ data->schema, false, &debug) < 0) {
g_autofree char *debugmsg = virBufferContentAndReset(&debug);
VIR_TEST_VERBOSE("json does not conform to QAPI schema");
g_auto(virBuffer) debug = VIR_BUFFER_INITIALIZER;
if (testQEMUSchemaValidate(data->images[i].formatprops, data->schemaroot,
- data->schema, &debug) < 0) {
+ data->schema, false, &debug) < 0) {
g_autofree char *debugmsg = virBufferContentAndReset(&debug);
g_autofree char *propsstr = virJSONValueToString(data->images[i].formatprops, true);
VIR_TEST_VERBOSE("json does not conform to QAPI schema");
virBufferFreeAndReset(&debug);
if (testQEMUSchemaValidate(data->images[i].storageprops, data->schemaroot,
- data->schema, &debug) < 0) {
+ data->schema, false, &debug) < 0) {
g_autofree char *debugmsg = virBufferContentAndReset(&debug);
g_autofree char *propsstr = virJSONValueToString(data->images[i].storageprops, true);
VIR_TEST_VERBOSE("json does not conform to QAPI schema");
virBufferFreeAndReset(&debug);
if (testQEMUSchemaValidate(data->images[i].storagepropssrc, data->schemaroot,
- data->schema, &debug) < 0) {
+ data->schema, false, &debug) < 0) {
g_autofree char *debugmsg = virBufferContentAndReset(&debug);
g_autofree char *propsstr = virJSONValueToString(data->images[i].storagepropssrc, true);
VIR_TEST_VERBOSE("json does not conform to QAPI schema");
return -1;
if (testQEMUSchemaValidate(formatprops, data->schemaroot, data->schema,
- &debug) < 0) {
+ false, &debug) < 0) {
g_autofree char *debugmsg = virBufferContentAndReset(&debug);
VIR_TEST_VERBOSE("blockdev-create format json does not conform to QAPI schema");
VIR_TEST_DEBUG("json:\n%s\ndoes not match schema. Debug output:\n %s",
return -1;
if (testQEMUSchemaValidate(protocolprops, data->schemaroot, data->schema,
- &debug) < 0) {
+ false, &debug) < 0) {
g_autofree char *debugmsg = virBufferContentAndReset(&debug);
VIR_TEST_VERBOSE("blockdev-create protocol json does not conform to QAPI schema");
VIR_TEST_DEBUG("json:\n%s\ndoes not match schema. Debug output:\n %s",
struct testQEMUSchemaValidateCtxt {
virHashTablePtr schema;
virBufferPtr debug;
+ bool allowDeprecated;
};
testQEMUSchemaValidate(virJSONValuePtr obj,
virJSONValuePtr root,
virHashTablePtr schema,
+ bool allowDeprecated,
virBufferPtr debug)
{
struct testQEMUSchemaValidateCtxt ctxt = { .schema = schema,
- .debug = debug };
+ .debug = debug,
+ .allowDeprecated = allowDeprecated };
+
return testQEMUSchemaValidateRecurse(obj, root, &ctxt);
}
* @command: command to validate
* @arguments: arguments of @command to validate
* @schema: hash table containing schema entries
+ * @allowDeprecated: don't fails schema validation if @command or one of @arguments
+ * is deprecated
+ * @allowRemoved: skip validation fully if @command was not found
* @debug: a virBuffer which will be filled with debug information if provided
*
* Validates whether @command and its @arguments conform to the QAPI schema
* -1 if it does not and -2 if there is a problem with the schema or with
* internals.
*
+ * @allowRemoved should generally be used only if it's certain that there's a
+ * replacement of @command in place.
+ *
* @debug is filled with information regarding the validation process
*/
int
testQEMUSchemaValidateCommand(const char *command,
virJSONValuePtr arguments,
virHashTablePtr schema,
+ bool allowDeprecated,
+ bool allowRemoved G_GNUC_UNUSED,
virBufferPtr debug)
{
struct testQEMUSchemaValidateCtxt ctxt = { .schema = schema,
- .debug = debug };
+ .debug = debug,
+ .allowDeprecated = allowDeprecated };
g_autofree char *schemapatharguments = g_strdup_printf("%s/arg-type", command);
g_autoptr(virJSONValue) emptyargs = NULL;
virJSONValuePtr schemarootcommand;