
On 01/21/2014 01:59 AM, Daniel P. Berrange wrote:
On Mon, Jan 20, 2014 at 06:53:28PM +0100, Thierry Parmentelat wrote:
Hi
Well if I need to run anything in the container context, short of entering it through e.g. ssh - hoping this is properly set up - well, I can’t..
I am using libvirt / lxc to set up a build box; essentially every night I would spawn a set of fresh VMs of some flavours (fedora18, ubuntu, what not) and use this to rebuild my system from scratch In this context it’s a real hassle to have to even set up ssh, there is no good reason for the build VM to run an ssh service at all, and I am concerned it might pull dependencies that I do not need/want I’d much rather have a direct means to just run some command inside the container.
Admittedly I’m brain-damaged after having used vservers for too long, and their ‘vserver <container> exec command to run’ feature is in my genes now ;)
Now maybe I am the one who is missing something and there already is something to do that ? Using the trick below I essentially have what I need mind you, I’m just concerned that it kind of works by accident :-)
Yes, it already exists, albeit as a lxc specific custom command/api:
$ virsh lxc-enter-namespace $CONTAINER /path/to/command/to/run arg1 arg2...
There's a corresponding API in the libvirt-lxc.so library virDomainLxcEnterNamspace
Eventually we'll turn this into a proper libvirt API with a less sucky virsh command name.
Sorry for another question, lxc-enter-namespace is unavailable on the remote machine, you can't use virsh -c lxc+ssh://root@x.x.x.x/ lxc-enter-namespace $CONTAINER /path/to/command/to/run arg1 arg2. I want to know what's the major handicap that we cannot support lxc-enter-namespace on remote machine. Thanks!