qemu-cr16/python/qemu/aqmp
John Snow 6e2f6ec561 python/aqmp: add send_fd_scm
Add an implementation for send_fd_scm to the async QMP implementation.
Like socket_scm_helper mentions, a non-empty payload is required for
QEMU to process the ancillary data. A space is most useful because it
does not disturb the parsing of subsequent JSON objects.

A note on "voiding the warranty":

Python 3.11 removes support for calling sendmsg directly from a
transport's socket. There is no other interface for doing this, our use
case is, I suspect, "quite unique".

As far as I can tell, this is safe to do -- send_fd_scm is a synchronous
function and we can be guaranteed that the async coroutines will *not* be
running when it is invoked. In testing, it works correctly.

I investigated quite thoroughly the possibility of creating my own
asyncio Transport (The class that ultimately manages the raw socket
object) so that I could manage the socket myself, but this is so wildly
invasive and unportable I scrapped the idea. It would involve a lot of
copy-pasting of various python utilities and classes just to re-create
the same infrastructure, and for extremely little benefit. Nah.

Just boldly void the warranty instead, while I try to follow up on
https://bugs.python.org/issue43232

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 20210923004938.3999963-5-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>
2021-10-12 12:22:10 -04:00
..
__init__.py python/aqmp: add scary message 2021-09-27 12:10:29 -04:00
aqmp_tui.py python/aqmp-tui: Add syntax highlighting 2021-09-27 12:10:29 -04:00
error.py
events.py python/aqmp: Return cleared events from EventListener.clear() 2021-10-12 12:22:10 -04:00
message.py python/aqmp: add QMP Message format 2021-09-27 12:10:29 -04:00
models.py python/aqmp: add well-known QMP object models 2021-09-27 12:10:29 -04:00
protocol.py python/aqmp: add AsyncProtocol._readline() method 2021-09-27 12:10:29 -04:00
py.typed
qmp_client.py python/aqmp: add send_fd_scm 2021-10-12 12:22:10 -04:00
util.py python/aqmp: add asyncio_run compatibility wrapper 2021-09-27 12:10:29 -04:00