qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 4/5] monitor: add object-add (QMP) and object_ad


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH 4/5] monitor: add object-add (QMP) and object_add (HMP) command
Date: Tue, 10 Dec 2013 19:15:05 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130923 Thunderbird/17.0.9

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Il 10/12/2013 19:00, Eric Blake ha scritto:
>>> +  'data': {'qom-type': 'str', 'id': 'str', '*props': 'dict'}, 
>>> +  'gen': 'no' }
> 
> This feels VERY open-coded.  No where else in qapi-schema do we 
> have 'dict' as a type

Yes, in fact the "data" field is entirely skipped by the code
generator (that's 'gen':'no').

> ; using it violates all sorts of type-safety (which, I guess, is 
> the point), making it impossible to introspect what keys are valid
>  for use in the "props":{...} dictionary.  Do we really want to 
> play this fast and loose with the type system, or should we try 
> harder to make this a robust self-describing union of types?
> 
> That is, why can't we have object-add use a discriminated union, 
> where qom-type is the discriminator, and where props is an 
> appropriate JSON struct type that corresponds to the branch of the
>  union, so that we get full introspection on the set of valid keys
>  to put in props for any given qom-type?

The point of "props" is passing arbitrary data to a QOM object.  We
should indeed have introspection for QOM objects, where each QOM class
name can be introspected separately.  However, the union of all
possible QOM objects need not have a "C struct" representation.

Thanks for your review!

Paolo
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBAgAGBQJSp1opAAoJEBvWZb6bTYbyTBoP/RJVnEPZB/JyPH3ybHWpPdAs
3Khn04tSLTsgjmoLBdNwnIDgLQeS2nJYoASVrhIBDhA+heKWgeMH/NGvjB4t8Sug
szVUEmzyeLPEeOydyBX4AfG4yFK39ds3iVjZbJlqQ6Jw50KznIX7mJdgcPiL9ZgQ
PJjvFZ1HGqpNXYMhOPIPgkVEOuN7Z1I9Rf+gyyT2zggn+2Kmo7qs3t5sM1HHbA96
3dPV0PLwieDbqok5RpPFgHAQvrlueMiDEb9yBibfqQ/7blTvJ7tZOpaoXw+9ZddA
zOhBnl9O8vnSM7H+uGVulBtwAXJ4HzSeBIlJ03F5Jln57fmRvfqmhB2ewYlx1pJ3
oYmlyOnLhtVYRqWzry4DrqmewpB19BbHsEbo/9OsCSkfwCLeYQss0S5yeKZlm3GG
LO7zI1iUYulUJJAWbJjoO1MklVNLG9NFYhQkSD4x7mRA9UoYFcGPqK8A5m8XVSkE
APV9di6igTGDA9XvYVxYHZhXgnJ2RzdDXjLJU/gh59INzxaaJaAHM/ye4q0YjAN3
ywzmTnEdfPn4ZsTpnPUMhBIQs2bGMjq2mYoHOMVlkwvuyA8yFsOlFz4fAql/RjJQ
fwJCmJdxgxeRXyqkHOF4szUtTKJI6Pn80vxrMvVTNlPv2vw+AJmMW7LtUVXCbQlg
E/3heznvclCSoKNjrbuo
=BRjp
-----END PGP SIGNATURE-----



reply via email to

[Prev in Thread] Current Thread [Next in Thread]