qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] qapi: What does "'gen': false" actually do, and when sh


From: Markus Armbruster
Subject: Re: [Qemu-devel] qapi: What does "'gen': false" actually do, and when should I use it?
Date: Thu, 02 Jul 2015 14:07:51 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Paolo Bonzini <address@hidden> writes:

> On 09/06/2015 10:42, Markus Armbruster wrote:
>> Part 2: When to use it?
>> 
>> We use 'gen': false when we can't (be bothered to) specify the exact
>> type of an argument or result.
>> 
>> Bad example: netdev_add
>> 
>>     We have arguments 'type': 'str' and '*props': '**'.
>> 
>>     We should have a union tagged by network backend type.  For each
>>     type, the union holds the type's properties (if any).
>
> The problem with this is that netdev_add was not type safe, because it
> uses qemu_opts_from_qdict and QemuOpts is exclusively string-based.  So
> you could write 'port': '123' or 'port': 123, and both would work, the
> conversion to integer is done by the QemuOptsVisitor.
>
> Note that device_add would have the same problem.

Yes.

We can always start over with a new command and deprecate the old one.

Or we can add a backward-misfeature-compatible mode to QmpInputVisitor,
enabled only for the misfeatured commands.



reply via email to

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