[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] marking SCM_RIGHTS qapi commands [was: [PATCH] tests/qmp-te
From: |
Eric Blake |
Subject: |
[Qemu-devel] marking SCM_RIGHTS qapi commands [was: [PATCH] tests/qmp-test: Add generic, basic test of query commands] |
Date: |
Fri, 11 Aug 2017 09:48:32 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 |
On 08/11/2017 04:08 AM, Markus Armbruster wrote:
> Eric Blake <address@hidden> writes:
>
>> On 08/10/2017 01:30 PM, Markus Armbruster wrote:
>>> A command is a query if it has no side effect and yields a result.
>>> Such commands are typically named query-FOO, but there are exceptions.
>>>
>>> The basic idea is to find candidates with query-qmp-schema, filter out
>>> the ones that aren't queries with an explicit blacklist, and test the
>>> remaining ones against a QEMU with no special arguments.
>>>
>>> The current blacklist is just add-fd.
>>
>> I guess this is because it has no mandatory parameters. Hmm - I wonder
>> if introspection should flag WHICH commands require an fd over SCM
>> rights (I guess just add-fd)
>
> Actually, add-fd and getfd.
>
> An obvious alternative is of course adding another optional member to
> the command object, say a flag "takes file descriptors via SCM_RIGHTS".
> Do we need to express the number of file descriptors it takes? The
> underlying infrastructure supports several (TCP_MAX_FDS in
> char-socket.c), but the existing commands take just one.
Yeah, I was definitely leaning towards an additional annotation - maybe
where the .json file has:
{ 'command': 'add-fd', 'data': {'*fdset-id': 'int', '*opaque': 'str'},
'fds': 1, 'returns': 'AddfdInfo' }
where the new 'fds' is what designates that the command expects to
consume 1 fd by SCM_RIGHTS (defaults to 0 when not present, and could be
larger than one if a command is ever designed to take multiple fds in
one go - although I find SCM_RIGHTS tricky enough with 1 fd that passing
multiple is probably not necessary, so maybe false/true is better than
int). The introspection output would similarly expose the same optional
member for each command object, repeating what was present in the .json
file.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature