[libvirt-users] lxc-enter-namespace support in Python API

Florian Haas florian at hastexo.com
Fri Mar 13 08:55:13 UTC 2015


Hello everyone,

referring back to
https://www.redhat.com/archives/libvirt-users/2013-August/msg00107.html,
in which a user discovered that there is no equivalent to "virsh -c
lxc:/// lxc-enter-namespace" in the Python API. Has that ever changed?
In that thread Daniel suggested that the user file a bug, but that
apparently never happened.

Why am I interested in this? Ansible currently supports a somewhat
limited libvirt_lxc connection driver which uses lxc-enter-namespace
to access LXC containers without SSH
(https://github.com/ansible/ansible/blob/devel/lib/ansible/runner/connection_plugins/libvirt_lxc.py).
That connection driver, written in Python like the rest of Ansible,
currently has to use jump through subprocess hoops with virsh to enter
the namespace, which is slow and doesn't support pipelining. Being
able to use the native Python API would help greatly. In addition, if
it were to use the Python API instead, the connection plugin could
also be extended to use lxc+ssh:// connection types so Ansible users
could potentially manage container hosts _and_ all their containers
from a single playbook, just so long as they have SSH access to the
host.

Does anyone know whether that extension of the API is being / has been
addressed?

Cheers,
Florian





More information about the libvirt-users mailing list