[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] What is the robust/recommended way to retrieve the PID of a VM's init process ?



Oh, I had totally failed to spot that one..
Thanks for the tip, I’ll give this a try :-)

On 20 Jan 2014, at 18:59, Daniel P. Berrange <berrange redhat com> 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.
> 
> Daniel
> -- 
> |: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
> |: http://libvirt.org              -o-             http://virt-manager.org :|
> |: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
> |: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]