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

Il 25/11/2013 17:43, Eric Blake ha scritto:
>>> This is unfortunately a counter-example to the rule that HMP 
>>> commands should always be implemented in terms of their QMP 
>>> counterparts.  I do not believe this is really a problem.  It 
>>> can be fixed later; for now, I think "perfect is the enemy of 
>>> good" applies.
> Hey - I just realized that now that we have anonymous unions, we 
> could theoretically extend QMP to allow a union between 'int' and 
> 'string' - if an 'int' is passed, it is in bytes; if a 'string' is 
> passed, then parse it the way HMP would (so the string "1G" would 
> be equivalent to the raw int 1073741824).  But I don't know if it 
> will help you (libvirt will still prefer to use raw ints in any
> QMP log you read off of libvirt interactions).

No, I think this is not the right solution.  The parsing should not be
handled at the schema level, because there is really no fixed schema
(like device_add for example).

Right now, we have (almost) always:

    HMP                             QMP
     |                               |
     |                               |
  hmp_cont (manually written)    qmp_marshal_cont (generated)
      \                             /
       \                           /
        qmp_cont (manually written)

where hmp_cont and qmp_marshal_cont both take QDicts, while qmp_cont
takes a list of parameters.

object_add cannot be described by a schema, so the implementation
should take a Visitor instead, and the would have to be written by
hand too:

    HMP                                 QMP
     |                                   |
     |                                   |
  hmp_object_add (manually written)    qmp_object_add (manually written)
          \                             /
           \                           /
        qapi_object_add(const char *type, const char *id, Visitor *v,
                        Error **errp)

However, we don't have the infrastructure to do it; hmp_object_add and
qmp_object_add cannot yet be simple wrappers around a common function.
 We can fix that in due time.

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

iQIcBAEBAgAGBQJSk4KFAAoJEBvWZb6bTYbyyJQP/AlDytO9om7XNu/+/7XGNVYj
HxiQSpOo3OgOeyLqJLSV2iBxP1F2YPG3IQ1MQE6aWbPdraMtBt0bnpEQDW5GinX6
f91cnpZi3Yf+3v2/rzmtEs1+3ACOjrn1rVBQiGrbbPiFr7Oa49RD5gWo06M2vZin
mfNt3hfUHrmS096IzxGF/sjFstDacnigJZYHHHImqWdHv7BS1I1fK4JptU8ESTEV
lLxvphcPKUGoTkLuDSy/6+TwLpr87aLjXFH7GrDUPdmGC/IcJYIDLMP3kjX3KdaA
sizqN/pATsxDpOMi/cxnD5onZsFi0J1RiIKxXRbdSLMD0udJUuRrcy19AnUvxhAI
gcJy32vj1QWff58S21O7ZbMPCHGClbed3j350wsciumObXneQbcd9iCU//L+Kcfh
DqAJmEqSn/kC6vny2JIKL2ZPzETxX6BtnRYIK1lQpYHhy/WC8x9pEs4wltWlVyEQ
sY6qq1brNKzCfBpe2WQiHHKHkZ3sw59Pt5bT0ToIpPODIqAyCoeFWh2yXdIEIKmp
U7VfBsjk7D6mSqCONgz74Qkjl8olNjlX4vCCXvjTiXghghF84dohNJG7klie75ad
arAVmRUTNeR39AY7BCnEKBGFt/OBQal++2ZN/r4AJk7xODs35qF6FMKioAHstt0Z
buoUSQmj9X7iuQV3Jriv
=fuqh
-----END PGP SIGNATURE-----

Reply via email to