[libvirt] [PATCH] Expose name + UUID to LXC containers via env variables
Daniel P. Berrange
berrange at redhat.com
Tue Feb 22 15:02:31 UTC 2011
On Tue, Feb 22, 2011 at 07:50:43AM -0700, Eric Blake wrote:
> On 02/22/2011 07:08 AM, Daniel P. Berrange wrote:
> > When spawning 'init' in the container, set
> >
> > LIBVIRT_LXC_UUID=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
> > LIBVIRT_LXC_NAME=YYYYYYYYYYYY
> >
> > to allow guest software to detect & identify that they
> > are in a container
>
> Sounds reasonable. Does virt-what know to look for these yet?
>
> > @@ -109,6 +124,8 @@ static int lxcContainerExecInit(virDomainDefPtr vmDef)
> > const char *const envp[] = {
> > "PATH=/bin:/sbin",
> > "TERM=linux",
> > + uuidenv,
> > + nameenv,
> > NULL,
> > };
>
> ACK, but why aren't we using virCommand yet?
Containers are very special in their startup requirements. You can't use
a plain fork()+exec() to create them. We use clone() call with a bunch of
magic flags, and then do crazy stuff pivot_root/mount setup and finally
execve() the container init process.
Regards,
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 :|
More information about the libvir-list
mailing list