summary refs log tree commit diff stats
path: root/python/qemu/aqmp/qmp_client.py
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2021-11-23 09:41:09 +0100
committerRichard Henderson <richard.henderson@linaro.org>2021-11-23 09:41:09 +0100
commit3c2a46d5286b475ce9fc81cbf0ed47af5adeff6b (patch)
tree689ac26ec57d170680f735c7b5573796f62170a3 /python/qemu/aqmp/qmp_client.py
parent6d9c9603ad2ffdbf2aae3f01955c17591287cb4c (diff)
parenta57cb3e23d5ac918a69d0aab918470ff0b429ff9 (diff)
downloadfocaccia-qemu-3c2a46d5286b475ce9fc81cbf0ed47af5adeff6b.tar.gz
focaccia-qemu-3c2a46d5286b475ce9fc81cbf0ed47af5adeff6b.zip
Merge tag 'python-pull-request' of https://gitlab.com/jsnow/qemu into staging
Python testing fixes for 6.2

A few more fixes to help eliminate race conditions from
device-crash-test, along with a fix that allows the SCM_RIGHTS
functionality to work on hosts that only have Python 3.6.

If this is too much this late in the RC process, I'd advocate for at
least patch 7/7 by itself.

# gpg: Signature made Tue 23 Nov 2021 03:37:17 AM CET
# gpg:                using RSA key F9B7ABDBBCACDF95BE76CBD07DEF8106AAFC390E
# gpg: Good signature from "John Snow (John Huston) <jsnow@redhat.com>" [full]

* tag 'python-pull-request' of https://gitlab.com/jsnow/qemu:
  python/aqmp: fix send_fd_scm for python 3.6.x
  scripts/device-crash-test: Use a QMP timeout
  python/machine: handle "fast" QEMU terminations
  python/machine: move more variable initializations to _pre_launch
  python/machine: add instance disambiguator to default nickname
  python/machine: remove _remove_monitor_sockfile property
  python/machine: add @sock_dir property

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'python/qemu/aqmp/qmp_client.py')
-rw-r--r--python/qemu/aqmp/qmp_client.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/python/qemu/aqmp/qmp_client.py b/python/qemu/aqmp/qmp_client.py
index f987da02eb..8105e29fa8 100644
--- a/python/qemu/aqmp/qmp_client.py
+++ b/python/qemu/aqmp/qmp_client.py
@@ -639,9 +639,12 @@ class QMPClient(AsyncProtocol[Message], Events):
         if sock.family != socket.AF_UNIX:
             raise AQMPError("Sending file descriptors requires a UNIX socket.")
 
-        # Void the warranty sticker.
-        # Access to sendmsg in asyncio is scheduled for removal in Python 3.11.
-        sock = sock._sock  # pylint: disable=protected-access
+        if not hasattr(sock, 'sendmsg'):
+            # We need to void the warranty sticker.
+            # Access to sendmsg is scheduled for removal in Python 3.11.
+            # Find the real backing socket to use it anyway.
+            sock = sock._sock  # pylint: disable=protected-access
+
         sock.sendmsg(
             [b' '],
             [(socket.SOL_SOCKET, socket.SCM_RIGHTS, struct.pack('@i', fd))]