[Avocado-devel] Fwd: Passing File Descriptors with Avocado tests

Beraldo Leal bleal at redhat.com
Tue Nov 24 16:32:03 UTC 2020


Hi Jagannathan,

This was not published on avocado-devel since it is moderated. Sorry
about that.

Replying here to reach Cleber, afaict, he was working with fd on QEMU.

--
Beraldo

On Mon, Nov 23, 2020 at 03:29:47PM -0500, Jagannathan Raman wrote:
> 
> 
> Hi,
> 
> I’m trying to pass a file descriptor to the QEMU process created by Avocado. However,
> I’m having some trouble with it. Could someone please help me with it?
> 
> For context, I’m attaching the source code of the test I’m having trouble with. The test is
> trying to pass “remote_sock” and “proxy_sock” as arguments to the QEMU processes.
> However, it looks like python3 does not allow child processes from inheriting file
> descriptors by default. I believe python3 requires the subprocess.Popen() method to
> specify the file descriptors to be passed in using the “padd_fds” argument. I’m wondering
> if there is a way to tell Test.vm.launch() method to pass some file descriptors to the
> QEMU processes. Could you please confirm?
> 
> Thank you very much!
> --
> Jag
> 
> 
> 
> 
> Begin forwarded message:
> 
> > From: Jagannathan Raman <jag.raman at oracle.com>
> > Date: November 21, 2020 at 8:43:01 PM EST
> > To: Philippe Mathieu-Daudé <philmd at redhat.com>
> > Cc: Elena Ufimtseva <elena.ufimtseva at oracle.com>, Stefan Hajnoczi <stefanha at redhat.com>
> > Subject: Passing File Descriptors with Avocado tests
> > 
> > Hi Phil,
> > 
> > I’ve hit a roadblock while working on the acceptance test you wanted us to do.
> > 
> > The issue is that we are not able to pass file descriptors from the Avocado python module to QEMU. By default, python3 prevents the child process from inheriting the parent’s file descriptor (which is a change from python2, which allowed file descriptor to inherited from the parent automatically).
> > 
> > For this reason, we used “pass_fds” argument with the subprocess.Popen() method, in the script we included. However, we are wondering how to achieve something similar in the context of the avocado tests.
> > 
> > Is there a way to tell the “Test.vm” object in Avocado to pass certain fds to the child process?
> > 
> > Do you where the source for Test.vm object is? I’m wondering if we could add arguments to the Test.vm.launch() method to allow some file descriptors to be passed to the child.
> > 
> > We have everything in place for the next series of patches. We’ve been stuck on this one, and wondering how to proceed further.
> > 
> > Thank you very much!
> > —
> > Jag




More information about the Avocado-devel mailing list