]> git.proxmox.com Git - mirror_qemu.git/commit - python/qemu/qmp/legacy.py
python/aqmp: add socket bind step to legacy.py
authorJohn Snow <jsnow@redhat.com>
Tue, 1 Feb 2022 04:11:34 +0000 (23:11 -0500)
committerJohn Snow <jsnow@redhat.com>
Wed, 2 Feb 2022 19:12:22 +0000 (14:12 -0500)
commitb0b662bb2b340d63529672b5bdae596a6243c4d0
tree77713ac01f584247f22415c6735e598a4ba78815
parent74a1505d279897d2a448c876820a33cbe1f0f22e
python/aqmp: add socket bind step to legacy.py

The synchronous QMP library would bind to the server address during
__init__(). The new library delays this to the accept() call, because
binding occurs inside of the call to start_[unix_]server(), which is an
async method -- so it cannot happen during __init__ anymore.

Python 3.7+ adds the ability to create the server (and thus the bind()
call) and begin the active listening in separate steps, but we don't
have that functionality in 3.6, our current minimum.

Therefore ... Add a temporary workaround that allows the synchronous
version of the client to bind the socket in advance, guaranteeing that
there will be a UNIX socket in the filesystem ready for the QEMU client
to connect to without a race condition.

(Yes, it's a bit ugly. Fixing it more nicely will have to wait until our
minimum Python version is 3.7+.)

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Message-id: 20220201041134.1237016-5-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>
python/qemu/aqmp/legacy.py
python/qemu/aqmp/protocol.py