[PATCH v2 01/13] Revert "python/aqmp: fix send_fd_scm for python 3.6.x"

Daniel P. Berrangé posted 13 patches 3 weeks, 5 days ago
Maintainers: "Alex Bennée" <alex.bennee@linaro.org>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Thomas Huth <thuth@redhat.com>, John Snow <jsnow@redhat.com>, Cleber Rosa <crosa@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, Kevin Wolf <kwolf@redhat.com>, Hanna Reitz <hreitz@redhat.com>
There is a newer version of this series
[PATCH v2 01/13] Revert "python/aqmp: fix send_fd_scm for python 3.6.x"
Posted by Daniel P. Berrangé 3 weeks, 5 days ago
This reverts commit a57cb3e23d5ac918a69d0aab918470ff0b429ff9.

The current code now only requires compatibility with Python
3.8 or later.

The conditional usage of 'sendmsg' on the async IO socket
wrapper will generate a deprecation warning on stderr
every time send_fd_scm is used with older Python versions.

This has the effect of breaking the QEMU I/O tests when run
on Python versions before the 'sendmsg' wrapper was removed.

Unconditionally accessing 'sock._sock' ensures we never use
the asyncio socket wrapper, and thus never risk triggering
deprecation warnings on any Python version

Most notably this fixes the QEMU block I/O tests on CentOS
Stream9 that use "sendmsg" for FD passing, which otherwise
generate deprecation messages breaking the expected output
comparison.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 python/qemu/qmp/qmp_client.py | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/python/qemu/qmp/qmp_client.py b/python/qemu/qmp/qmp_client.py
index 8beccfe29d..7a115b693b 100644
--- a/python/qemu/qmp/qmp_client.py
+++ b/python/qemu/qmp/qmp_client.py
@@ -720,12 +720,9 @@ def send_fd_scm(self, fd: int) -> None:
         if sock.family != socket.AF_UNIX:
             raise QMPError("Sending file descriptors requires a UNIX socket.")
 
-        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
-
+        # Void the warranty sticker.
+        # Access to sendmsg in asyncio is scheduled for removal in Python 3.11.
+        sock = sock._sock  # pylint: disable=protected-access
         sock.sendmsg(
             [b' '],
             [(socket.SOL_SOCKET, socket.SCM_RIGHTS, struct.pack('@i', fd))]
-- 
2.52.0


Re: [PATCH v2 01/13] Revert "python/aqmp: fix send_fd_scm for python 3.6.x"
Posted by Thomas Huth 3 weeks, 5 days ago
On 12/01/2026 21.40, Daniel P. Berrangé wrote:
> This reverts commit a57cb3e23d5ac918a69d0aab918470ff0b429ff9.
> 
> The current code now only requires compatibility with Python
> 3.8 or later.
> 
> The conditional usage of 'sendmsg' on the async IO socket
> wrapper will generate a deprecation warning on stderr
> every time send_fd_scm is used with older Python versions.
> 
> This has the effect of breaking the QEMU I/O tests when run
> on Python versions before the 'sendmsg' wrapper was removed.
> 
> Unconditionally accessing 'sock._sock' ensures we never use
> the asyncio socket wrapper, and thus never risk triggering
> deprecation warnings on any Python version
> 
> Most notably this fixes the QEMU block I/O tests on CentOS
> Stream9 that use "sendmsg" for FD passing, which otherwise
> generate deprecation messages breaking the expected output
> comparison.
> 
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
>   python/qemu/qmp/qmp_client.py | 9 +++------
>   1 file changed, 3 insertions(+), 6 deletions(-)

Reviewed-by: Thomas Huth <thuth@redhat.com>


Re: [PATCH v2 01/13] Revert "python/aqmp: fix send_fd_scm for python 3.6.x"
Posted by John Snow 3 weeks, 4 days ago
On Tue, Jan 13, 2026 at 2:17 AM Thomas Huth <thuth@redhat.com> wrote:
>
> On 12/01/2026 21.40, Daniel P. Berrangé wrote:
> > This reverts commit a57cb3e23d5ac918a69d0aab918470ff0b429ff9.
> >
> > The current code now only requires compatibility with Python
> > 3.8 or later.
> >
> > The conditional usage of 'sendmsg' on the async IO socket
> > wrapper will generate a deprecation warning on stderr
> > every time send_fd_scm is used with older Python versions.
> >
> > This has the effect of breaking the QEMU I/O tests when run
> > on Python versions before the 'sendmsg' wrapper was removed.
> >
> > Unconditionally accessing 'sock._sock' ensures we never use
> > the asyncio socket wrapper, and thus never risk triggering
> > deprecation warnings on any Python version
> >
> > Most notably this fixes the QEMU block I/O tests on CentOS
> > Stream9 that use "sendmsg" for FD passing, which otherwise
> > generate deprecation messages breaking the expected output
> > comparison.
> >
> > Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> > ---
> >   python/qemu/qmp/qmp_client.py | 9 +++------
> >   1 file changed, 3 insertions(+), 6 deletions(-)
>
> Reviewed-by: Thomas Huth <thuth@redhat.com>

OK, please merge this with my blessing and I will worry about the
standalone repo afterwards.

Acked-by: John Snow <jsnow@redhat.com>
Re: [PATCH v2 01/13] Revert "python/aqmp: fix send_fd_scm for python 3.6.x"
Posted by Daniel P. Berrangé 3 weeks, 4 days ago
On Wed, Jan 14, 2026 at 11:57:23AM -0500, John Snow wrote:
> On Tue, Jan 13, 2026 at 2:17 AM Thomas Huth <thuth@redhat.com> wrote:
> >
> > On 12/01/2026 21.40, Daniel P. Berrangé wrote:
> > > This reverts commit a57cb3e23d5ac918a69d0aab918470ff0b429ff9.
> > >
> > > The current code now only requires compatibility with Python
> > > 3.8 or later.
> > >
> > > The conditional usage of 'sendmsg' on the async IO socket
> > > wrapper will generate a deprecation warning on stderr
> > > every time send_fd_scm is used with older Python versions.
> > >
> > > This has the effect of breaking the QEMU I/O tests when run
> > > on Python versions before the 'sendmsg' wrapper was removed.
> > >
> > > Unconditionally accessing 'sock._sock' ensures we never use
> > > the asyncio socket wrapper, and thus never risk triggering
> > > deprecation warnings on any Python version
> > >
> > > Most notably this fixes the QEMU block I/O tests on CentOS
> > > Stream9 that use "sendmsg" for FD passing, which otherwise
> > > generate deprecation messages breaking the expected output
> > > comparison.
> > >
> > > Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> > > ---
> > >   python/qemu/qmp/qmp_client.py | 9 +++------
> > >   1 file changed, 3 insertions(+), 6 deletions(-)
> >
> > Reviewed-by: Thomas Huth <thuth@redhat.com>
> 
> OK, please merge this with my blessing and I will worry about the
> standalone repo afterwards.

We already merged it there with:

  https://gitlab.com/qemu-project/python-qemu-qmp/-/merge_requests/45

> 
> Acked-by: John Snow <jsnow@redhat.com>
> 

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|