Re: [PATCH 07/10] qemu-replies-tool: Add validation of known fields in 'query-qmp-schema'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <pkrempa@xxxxxxxxxx>
> ---
>  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 -- devel@xxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux