All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] python/qemu: Don't choke on unknown members in QMP replies
@ 2026-11-18 18:20 Markus Armbruster
  2026-11-19 11:36 ` Daniel P. Berrangé
  2026-11-19 18:11 ` John Snow
  0 siblings, 2 replies; 4+ messages in thread
From: Markus Armbruster @ 2026-11-18 18:20 UTC (permalink / raw)
  To: qemu-devel; +Cc: jsnow, crosa, marcandre.lureau

The recent addition of @qapi-type to ObjectPropertyInfo and
ObjectPropertyValue broke the corresponding classes in
qemu/utils/qom_common.  Reproducer:

    $ bld/run qom-list -s qmp-socket /chardevs
    Traceback (most recent call last):
      File "/work/armbru/qemu/bld/pyvenv/bin/qom-list", line 8, in <module>
        sys.exit(QOMList.entry_point())
                 ~~~~~~~~~~~~~~~~~~~^^
      File "/work/armbru/qemu/python/qemu/utils/qom_common.py", line 230, in entry_point
        return cls.command_runner(args)
               ~~~~~~~~~~~~~~~~~~^^^^^^
      File "/work/armbru/qemu/python/qemu/utils/qom_common.py", line 215, in command_runner
        return cmd.run()
               ~~~~~~~^^
      File "/work/armbru/qemu/python/qemu/utils/qom.py", line 179, in run
        rsp = self.qom_list(self.path)
      File "/work/armbru/qemu/python/qemu/utils/qom_common.py", line 192, in qom_list
        return [ObjectPropertyInfo.make(x) for x in rsp]
                ~~~~~~~~~~~~~~~~~~~~~~~^^^
      File "/work/armbru/qemu/python/qemu/utils/qom_common.py", line 52, in make
        assert value.keys() <= {'name', 'type', 'description', 'default-value'}
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    AssertionError

This asserts "no members we don't know".  There are two more like it.

Adding @qapi-type broke them.

docs/devel/qapi-code-gen.rst section "Compatibility considerations"
stipulates that "clients are expected to ignore [members] they don't
know."

Delete / relax these assertions.

Fixes: 0eee31cf1085 ("qapi/qom: add qapi-type to qom-list, qom-list-properties, qom-list-get")
Fixes: c750c02891a8 ("python/qmp: Add qom script rewrites")
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 python/qemu/utils/qom_common.py | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/python/qemu/utils/qom_common.py b/python/qemu/utils/qom_common.py
index ab21a4d364a..e5bae1c7421 100644
--- a/python/qemu/utils/qom_common.py
+++ b/python/qemu/utils/qom_common.py
@@ -49,7 +49,6 @@ def make(cls, value: Dict[str, Any]) -> 'ObjectPropertyInfo':
         Build an ObjectPropertyInfo from a Dict with an unknown shape.
         """
         assert value.keys() >= {'name', 'type'}
-        assert value.keys() <= {'name', 'type', 'description', 'default-value'}
         return cls(value['name'], value['type'],
                    value.get('description'),
                    value.get('default-value'))
@@ -80,7 +79,6 @@ def make(cls, value: Dict[str, Any]) -> 'ObjectPropertyValue':
         Build an ObjectPropertyValue from a Dict with an unknown shape.
         """
         assert value.keys() >= {'name', 'type'}
-        assert value.keys() <= {'name', 'type', 'value'}
         return cls(value['name'], value['type'], value.get('value'))
 
     @property
@@ -103,7 +101,7 @@ def make(cls, value: Dict[str, Any]) -> 'ObjectPropertiesValues':
         """
         Build an ObjectPropertiesValues from a Dict with an unknown shape.
         """
-        assert value.keys() == {'properties'}
+        assert value.keys() <= {'properties'}
         props = [ObjectPropertyValue(item['name'],
                                      item['type'],
                                      item.get('value'))
-- 
2.55.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] python/qemu: Don't choke on unknown members in QMP replies
  2026-11-18 18:20 [PATCH] python/qemu: Don't choke on unknown members in QMP replies Markus Armbruster
@ 2026-11-19 11:36 ` Daniel P. Berrangé
  2026-11-19 18:11 ` John Snow
  1 sibling, 0 replies; 4+ messages in thread
From: Daniel P. Berrangé @ 2026-11-19 11:36 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: qemu-devel, jsnow, crosa, marcandre.lureau

On Wed, Nov 18, 2026 at 07:20:05PM +0100, Markus Armbruster wrote:
> The recent addition of @qapi-type to ObjectPropertyInfo and
> ObjectPropertyValue broke the corresponding classes in
> qemu/utils/qom_common.  Reproducer:
> 
>     $ bld/run qom-list -s qmp-socket /chardevs
>     Traceback (most recent call last):
>       File "/work/armbru/qemu/bld/pyvenv/bin/qom-list", line 8, in <module>
>         sys.exit(QOMList.entry_point())
>                  ~~~~~~~~~~~~~~~~~~~^^
>       File "/work/armbru/qemu/python/qemu/utils/qom_common.py", line 230, in entry_point
>         return cls.command_runner(args)
>                ~~~~~~~~~~~~~~~~~~^^^^^^
>       File "/work/armbru/qemu/python/qemu/utils/qom_common.py", line 215, in command_runner
>         return cmd.run()
>                ~~~~~~~^^
>       File "/work/armbru/qemu/python/qemu/utils/qom.py", line 179, in run
>         rsp = self.qom_list(self.path)
>       File "/work/armbru/qemu/python/qemu/utils/qom_common.py", line 192, in qom_list
>         return [ObjectPropertyInfo.make(x) for x in rsp]
>                 ~~~~~~~~~~~~~~~~~~~~~~~^^^
>       File "/work/armbru/qemu/python/qemu/utils/qom_common.py", line 52, in make
>         assert value.keys() <= {'name', 'type', 'description', 'default-value'}
>                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>     AssertionError
> 
> This asserts "no members we don't know".  There are two more like it.
> 
> Adding @qapi-type broke them.
> 
> docs/devel/qapi-code-gen.rst section "Compatibility considerations"
> stipulates that "clients are expected to ignore [members] they don't
> know."

Yes, that is critical as we want to retain the right to add new
members at any time without breaking apps.

> 
> Delete / relax these assertions.
> 
> Fixes: 0eee31cf1085 ("qapi/qom: add qapi-type to qom-list, qom-list-properties, qom-list-get")
> Fixes: c750c02891a8 ("python/qmp: Add qom script rewrites")
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
>  python/qemu/utils/qom_common.py | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


With regards,
Daniel
-- 
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] python/qemu: Don't choke on unknown members in QMP replies
  2026-11-18 18:20 [PATCH] python/qemu: Don't choke on unknown members in QMP replies Markus Armbruster
  2026-11-19 11:36 ` Daniel P. Berrangé
@ 2026-11-19 18:11 ` John Snow
  2026-11-20  4:35   ` Markus Armbruster
  1 sibling, 1 reply; 4+ messages in thread
From: John Snow @ 2026-11-19 18:11 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: qemu-devel, crosa, marcandre.lureau

On Wed, Nov 18, 2026 at 1:20 PM Markus Armbruster <armbru@redhat.com> wrote:
>
> The recent addition of @qapi-type to ObjectPropertyInfo and
> ObjectPropertyValue broke the corresponding classes in
> qemu/utils/qom_common.  Reproducer:

Do we need that qapi-type for anything in the client?

>
>     $ bld/run qom-list -s qmp-socket /chardevs
>     Traceback (most recent call last):
>       File "/work/armbru/qemu/bld/pyvenv/bin/qom-list", line 8, in <module>
>         sys.exit(QOMList.entry_point())
>                  ~~~~~~~~~~~~~~~~~~~^^
>       File "/work/armbru/qemu/python/qemu/utils/qom_common.py", line 230, in entry_point
>         return cls.command_runner(args)
>                ~~~~~~~~~~~~~~~~~~^^^^^^
>       File "/work/armbru/qemu/python/qemu/utils/qom_common.py", line 215, in command_runner
>         return cmd.run()
>                ~~~~~~~^^
>       File "/work/armbru/qemu/python/qemu/utils/qom.py", line 179, in run
>         rsp = self.qom_list(self.path)
>       File "/work/armbru/qemu/python/qemu/utils/qom_common.py", line 192, in qom_list
>         return [ObjectPropertyInfo.make(x) for x in rsp]
>                 ~~~~~~~~~~~~~~~~~~~~~~~^^^
>       File "/work/armbru/qemu/python/qemu/utils/qom_common.py", line 52, in make
>         assert value.keys() <= {'name', 'type', 'description', 'default-value'}
>                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>     AssertionError
>
> This asserts "no members we don't know".  There are two more like it.
>
> Adding @qapi-type broke them.
>
> docs/devel/qapi-code-gen.rst section "Compatibility considerations"
> stipulates that "clients are expected to ignore [members] they don't
> know."
>
> Delete / relax these assertions.
>
> Fixes: 0eee31cf1085 ("qapi/qom: add qapi-type to qom-list, qom-list-properties, qom-list-get")
> Fixes: c750c02891a8 ("python/qmp: Add qom script rewrites")
> Signed-off-by: Markus Armbruster <armbru@redhat.com>

Reviewed-by: John Snow <jsnow@redhat.com>

> ---
>  python/qemu/utils/qom_common.py | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/python/qemu/utils/qom_common.py b/python/qemu/utils/qom_common.py
> index ab21a4d364a..e5bae1c7421 100644
> --- a/python/qemu/utils/qom_common.py
> +++ b/python/qemu/utils/qom_common.py
> @@ -49,7 +49,6 @@ def make(cls, value: Dict[str, Any]) -> 'ObjectPropertyInfo':
>          Build an ObjectPropertyInfo from a Dict with an unknown shape.
>          """
>          assert value.keys() >= {'name', 'type'}
> -        assert value.keys() <= {'name', 'type', 'description', 'default-value'}
>          return cls(value['name'], value['type'],
>                     value.get('description'),
>                     value.get('default-value'))
> @@ -80,7 +79,6 @@ def make(cls, value: Dict[str, Any]) -> 'ObjectPropertyValue':
>          Build an ObjectPropertyValue from a Dict with an unknown shape.
>          """
>          assert value.keys() >= {'name', 'type'}
> -        assert value.keys() <= {'name', 'type', 'value'}
>          return cls(value['name'], value['type'], value.get('value'))
>
>      @property
> @@ -103,7 +101,7 @@ def make(cls, value: Dict[str, Any]) -> 'ObjectPropertiesValues':
>          """
>          Build an ObjectPropertiesValues from a Dict with an unknown shape.
>          """
> -        assert value.keys() == {'properties'}
> +        assert value.keys() <= {'properties'}
>          props = [ObjectPropertyValue(item['name'],
>                                       item['type'],
>                                       item.get('value'))
> --
> 2.55.0
>



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] python/qemu: Don't choke on unknown members in QMP replies
  2026-11-19 18:11 ` John Snow
@ 2026-11-20  4:35   ` Markus Armbruster
  0 siblings, 0 replies; 4+ messages in thread
From: Markus Armbruster @ 2026-11-20  4:35 UTC (permalink / raw)
  To: John Snow; +Cc: qemu-devel, crosa, marcandre.lureau

John Snow <jsnow@redhat.com> writes:

> On Wed, Nov 18, 2026 at 1:20 PM Markus Armbruster <armbru@redhat.com> wrote:
>>
>> The recent addition of @qapi-type to ObjectPropertyInfo and
>> ObjectPropertyValue broke the corresponding classes in
>> qemu/utils/qom_common.  Reproducer:
>
> Do we need that qapi-type for anything in the client?

Not yet, but I'm working on a followup series that uses it.

>>
>>     $ bld/run qom-list -s qmp-socket /chardevs
>>     Traceback (most recent call last):
>>       File "/work/armbru/qemu/bld/pyvenv/bin/qom-list", line 8, in <module>
>>         sys.exit(QOMList.entry_point())
>>                  ~~~~~~~~~~~~~~~~~~~^^
>>       File "/work/armbru/qemu/python/qemu/utils/qom_common.py", line 230, in entry_point
>>         return cls.command_runner(args)
>>                ~~~~~~~~~~~~~~~~~~^^^^^^
>>       File "/work/armbru/qemu/python/qemu/utils/qom_common.py", line 215, in command_runner
>>         return cmd.run()
>>                ~~~~~~~^^
>>       File "/work/armbru/qemu/python/qemu/utils/qom.py", line 179, in run
>>         rsp = self.qom_list(self.path)
>>       File "/work/armbru/qemu/python/qemu/utils/qom_common.py", line 192, in qom_list
>>         return [ObjectPropertyInfo.make(x) for x in rsp]
>>                 ~~~~~~~~~~~~~~~~~~~~~~~^^^
>>       File "/work/armbru/qemu/python/qemu/utils/qom_common.py", line 52, in make
>>         assert value.keys() <= {'name', 'type', 'description', 'default-value'}
>>                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>     AssertionError
>>
>> This asserts "no members we don't know".  There are two more like it.
>>
>> Adding @qapi-type broke them.
>>
>> docs/devel/qapi-code-gen.rst section "Compatibility considerations"
>> stipulates that "clients are expected to ignore [members] they don't
>> know."
>>
>> Delete / relax these assertions.
>>
>> Fixes: 0eee31cf1085 ("qapi/qom: add qapi-type to qom-list, qom-list-properties, qom-list-get")
>> Fixes: c750c02891a8 ("python/qmp: Add qom script rewrites")
>> Signed-off-by: Markus Armbruster <armbru@redhat.com>
>
> Reviewed-by: John Snow <jsnow@redhat.com>

Thanks!


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-11-20  4:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-18 18:20 [PATCH] python/qemu: Don't choke on unknown members in QMP replies Markus Armbruster
2026-11-19 11:36 ` Daniel P. Berrangé
2026-11-19 18:11 ` John Snow
2026-11-20  4:35   ` Markus Armbruster

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.