On Tue, Jan 16, 2024 at 17:12:41 +0100, Peter Krempa wrote:
> If the schema itself is extended in qemu we need to have a notification
> to add appropriate handling to ensure that we have full coverage of all
> fields.
>
> Add validation that only fields that libvirt currently knows about are
> present in the schema.
>
> Signed-off-by: Peter Krempa <[email protected]>
> ---
> scripts/qemu-replies-tool.py | 145 +++++++++++++++++++++++++++++++++++
> 1 file changed, 145 insertions(+)
[...]
> +# Validate that the passed schema has only members supported by this script
> and
> +# by the libvirt internals. This is useful to stay up to date with any
> changes
> +# to the schema.
> +def validate_qmp_schema(schemalist):
> + for entry in schemalist:
> + if not isinstance(entry, dict):
> + raise qmpSchemaException("schema entry '%s' is not a JSON Object
> (dict)" % (entry))
> +
> + match entry.get('meta-type', None):
> + case 'command':
Gah, it turns out that match/case was introduced in python 3.10 and
based on CI failure we need to target older versions, thus I'll need to
convert this to if/elif or something equivalent.
_______________________________________________
Devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]