[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



Quoting Eric Blake (eblake redhat com):
> On 05/16/2011 08:47 AM, 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");
> 
> POSIX reserves lowercase env names for the user.  Is upstart really
> using a lower case name, or should this be an upper case name?

No upstart isn't doing anything itself :)  Just blame me - the upstart
scripts I put into lxcguest do in fact check for lower-case.

What do you mean by 'for the user'?  For the user to type into the
boot args, or something else?


> >      virCommandAddEnvPair(cmd, "LIBVIRT_LXC_UUID", uuidstr);
> >      virCommandAddEnvPair(cmd, "LIBVIRT_LXC_NAME", vmDef->name);
> 
> Can upstart be taught to look for LIBIVRT_LXC_UUID instead?

That's a possibility, yes.  It just makes it less symmetric to the
liblxc case, but if you prefer that I see no reason why it wouldn't
work.

thanks,
-serge


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