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

Re: [libvirt] [PATCH] send 'container=libvirt' in env to container init



On Tue, May 17, 2011 at 09:40:01AM -0500, Serge Hallyn wrote:
> Quoting Daniel P. Berrange (berrange redhat com):
> > On Mon, May 16, 2011 at 09:47:02AM -0500, Serge Hallyn wrote:
> > > This allows upstart scripts to detect that they are in a container
> > > and modify their behavior accordingly.
> > > 
> > > In this way, the same ubuntu maverick or natty image with the 'lxcguest'
> > > package installed can be booted on bare metal, in kvm, or as a
> > > libvirt or liblxc container.
> > > 
> > > Signed-off-by: Chuck Short <zulcss ubuntu com>
> > > Signed-off-by: Serge Hallyn <serge hallyn ubuntu com>
> > > ---
> > >  src/lxc/lxc_container.c |    1 +
> > >  1 files changed, 1 insertions(+), 0 deletions(-)
> > > 
> > > diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
> > > index 9ae93b5..a70aeeb 100644
> > > --- a/src/lxc/lxc_container.c
> > > +++ b/src/lxc/lxc_container.c
> > > @@ -112,6 +112,7 @@ static virCommandPtr lxcContainerBuildInitCmd(virDomainDefPtr vmDef)
> > >  
> > >      virCommandAddEnvString(cmd, "PATH=/bin:/sbin");
> > >      virCommandAddEnvString(cmd, "TERM=linux");
> > > +    virCommandAddEnvString(cmd, "container=libvirt");
> > >      virCommandAddEnvPair(cmd, "LIBVIRT_LXC_UUID", uuidstr);
> > >      virCommandAddEnvPair(cmd, "LIBVIRT_LXC_NAME", vmDef->name);
> > 
> > I've no objection to this, but IMHO the value should be
> > 
> >    container=libvirt-lxc
> 
> So long as it is guaranteed that henceforth LIBVIRT_LXC_UUID=x will always
> be passed to init, that suffices.  But I worry about it changing in 6 or
> 12 months to a slightly different name, or not always being passed.  Do
> you think there is any chance of that happening?

No, we intend the LIBVIRT_LXC_UUID/NAME  vars to be a permanent part of
the environment given to containers.


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]