qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH 01/25] qemu-option: clean up id vs. list->merge_lists


From: Markus Armbruster
Subject: Re: [PATCH 01/25] qemu-option: clean up id vs. list->merge_lists
Date: Wed, 20 Jan 2021 13:50:33 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)

Paolo Bonzini <pbonzini@redhat.com> writes:

> On 20/01/21 09:03, Markus Armbruster wrote:
>> The detour should be avoided, because QemuOpts should be avoided.  Using
>> the appropriate visitor, we get:
>>          char *optarg
>>               |
>>               |  v = qobject_input_visitor_new_str(string, NULL, errp)
>>               |  visit_type_q_obj_set_action_arg(v, NULL, &arg, errp);
>>               v
>>    q_obj_set_action_arg arg
>> except visit_type_q_obj_set_action_arg() doesn't exist, because the
>> QAPI
>> type is anonymous.  So give it a name:
>>      { 'struct: 'Action',
>>        'data': { '*reboot': 'RebootAction',
>>                  '*shutdown': 'ShutdownAction',
>>                  '*panic': 'PanicAction',
>>                  '*watchdog': 'WatchdogAction' } }
>>      { 'command': 'set-action',
>>        'data': 'Action',
>>        'allow-preconfig': true }
>>          char *optarg
>>               |
>>               |  v = qobject_input_visitor_new_str(string, NULL, errp)
>>               |  visit_type_Action(v, NULL, &arg, errp);
>>               v
>>           Action act
>> To avoid having to pass the members of Action to qmp_set_action(),
>> throw
>> in 'boxed': true, so you can simply call qmp_set_action(&act, errp).
>
> Ok, so the idea of a 1:1 CLI<->QMP mapping is good, the implementation
> is bad.  The reason it was done with QemuOpts was mostly to have 
> "-action help" for free.  Something to remember when working on
> autogenerated boilerplate.

Yes, help is another gap we still need to bridge.




reply via email to

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