[libvirt] libvirt python is not correctly passing file descriptors to underlying virDomainCreateWithFiles

Dear All, While working on a component handling container management I stumbled on a bug in the libvirt python bindings: basically the python bindings fail in properly translating the python file descriptor list to a native C array. The primary symptom was that inside the container the file descriptors are created but mapped to '/dev/null' instead of the original file descriptors This problem was discovered in libvirt 1.1.2 but the problem exists also in the current git head. I'm attaching a simple patch fixing the bug, and re-establishing the expected behaviour. I've also opened a bugzilla issue at https://bugzilla.redhat.com/show_bug.cgi?id=1021434 I hope this fix is acceptable and that it can be incorporated in the code base. :) Marian ~~~~~~~~~~~~~~~ Marian Neagul Universitatea de Vest din Timisoara Facultatea de Matematică și Informatică Centrul de Cercetare in Informatica marian@info.uvt.ro marian@hpc.uvt.ro

Attaching just in case the git formated patch. On Oct 21, 2013, at 8:03 PM, Marian Neagul <marian@info.uvt.ro> wrote:
Dear All,
While working on a component handling container management I stumbled on a bug in the libvirt python bindings: basically the python bindings fail in properly translating the python file descriptor list to a native C array. The primary symptom was that inside the container the file descriptors are created but mapped to '/dev/null' instead of the original file descriptors
This problem was discovered in libvirt 1.1.2 but the problem exists also in the current git head.
I'm attaching a simple patch fixing the bug, and re-establishing the expected behaviour. I've also opened a bugzilla issue at https://bugzilla.redhat.com/show_bug.cgi?id=1021434
I hope this fix is acceptable and that it can be incorporated in the code base. :)
Marian <libvirt-python-fix-lxc-fd-passing.patch>
~~~~~~~~~~~~~~~ Marian Neagul Universitatea de Vest din Timisoara Facultatea de Matematică și Informatică Centrul de Cercetare in Informatica
marian@info.uvt.ro marian@hpc.uvt.ro
~~~~~~~~~~~~~~~ Marian Neagul Universitatea de Vest din Timisoara Facultatea de Matematică și Informatică Centrul de Cercetare in Informatica marian@info.uvt.ro marian@hpc.uvt.ro

On 10/21/2013 06:03 PM, Marian Neagul wrote:
Dear All,
While working on a component handling container management I stumbled on a bug in the libvirt python bindings: basically the python bindings fail in properly translating the python file descriptor list to a native C array. The primary symptom was that inside the container the file descriptors are created but mapped to '/dev/null' instead of the original file descriptors
This problem was discovered in libvirt 1.1.2 but the problem exists also in the current git head.
I'm attaching a simple patch fixing the bug, and re-establishing the expected behaviour. I've also opened a bugzilla issue at https://bugzilla.redhat.com/show_bug.cgi?id=1021434
Thanks again for filing the bug and posting the patch; it looks like Martin applied it from a second thread: https://www.redhat.com/archives/libvir-list/2013-October/msg01009.html -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On Tue, Oct 22, 2013 at 04:42:31PM +0100, Eric Blake wrote:
On 10/21/2013 06:03 PM, Marian Neagul wrote:
Dear All,
While working on a component handling container management I stumbled on a bug in the libvirt python bindings: basically the python bindings fail in properly translating the python file descriptor list to a native C array. The primary symptom was that inside the container the file descriptors are created but mapped to '/dev/null' instead of the original file descriptors
This problem was discovered in libvirt 1.1.2 but the problem exists also in the current git head.
I'm attaching a simple patch fixing the bug, and re-establishing the expected behaviour. I've also opened a bugzilla issue at https://bugzilla.redhat.com/show_bug.cgi?id=1021434
Thanks again for filing the bug and posting the patch; it looks like Martin applied it from a second thread: https://www.redhat.com/archives/libvir-list/2013-October/msg01009.html
I must admit I completely missed this thread at first. But yes, I sent it, applied it and everything works as it should. One more thanks from me for letting us know and publishing the patch Martin
participants (3)
-
Eric Blake
-
Marian Neagul
-
Martin Kletzander