[lxc-devel] [PATCH] Add a non-null group for autobooting

Stéphane Graber stgraber at ubuntu.com
Fri May 2 21:41:25 UTC 2014


On Fri, May 02, 2014 at 05:37:37PM -0400, Stéphane Graber wrote:
> On Fri, May 02, 2014 at 05:20:11PM -0400, Michael H. Warfield wrote:
> > On Fri, 2014-05-02 at 17:09 -0400, Michael H. Warfield wrote:
> > > On Fri, 2014-05-02 at 21:03 +0000, Serge Hallyn wrote:
> > > > Quoting Michael H. Warfield (mhw at WittsEnd.com):
> > > > > On Thu, 2014-05-01 at 17:26 -0400, Michael H. Warfield wrote:
> > > > > > Looks good to me with the provisio that I feel that autoboot on bootup
> > > > > > should be for all groups and not just the null group.  Dwight told me in
> > > > > > another message that he did it that way because the Upstart script did
> > > > > > it that way.  Was it an oversight or was it a decision?  That can be a
> > > > > > separate patch to fix.
> > > > > 
> > > > > I haven't seen Dwight's patch go in and I haven't seen any other
> > > > > commentary about it or my suggested change.  His patch fixes a reported
> > > > > problem and my change supports allowing containers which are members of
> > > > > designated groups to boot (which I require).  Therefore, I'm submitting
> > > > > this patch.  Both "boot" and "autoboot" were suggested for names of the
> > > > > autoboot group.  I choose to use "onboot" just to make it a little
> > > > > clearer and disambiguate it from some of the other options.
> > > > > 
> > > > > This patch is dependent on Dwight's patch Subject:
> > > > > [PATCH v2] have systemd service call lxc-autostart via script
> > > > > 
> > > > > Regards,
> > > > > Mike
> > > > > 
> > > > > -- 
> > > > > Add a non-null group for autobooting
> > > > > 
> > > > > This adds a non-null group (onboot) to the sysvinit startup script
> > > > > for autobooting containers.  This allows for containers which are
> > > > > in other groups to be included in the autoboot process.
> > > > > 
> > > > > This script is used by both the sysvinit systems and the systemd
> > > > > systems.
> > > > > 
> > > > > Signed-off-by: Michael H. Warfield <mhw at WittsEnd.com>
> > 
> > > > While this is the right place to do it, I don't think we should encourage
> > > > differences among init systems...  So we should either do it in upstart
> > > > as well, or not do it at all imo.  Otherwise admins will become very
> > > > confused.
> > 
> > > I absolutely agree but I haven't been involved in that one.  I would
> > > strongly recommend that someone update the Upstart stuff.  Do you want
> > > me to look at it or do you want someone more familiar with Upstart to
> > > look at it?  I'll take a look.
> > 
> > I just had a look in that area and I have no idea what those files are
> > doing.  I gather they're doing an "lxc-autostart -L" and then picking
> > off the first parameter as a container name to start in "lxc-instance"
> > and I can see where "order" might be handled by "lxc-autostart -L" in
> > the output but where is the "delay" parameter managed?  The "simple"
> > thing would be to prepend another loop.  I'll submit a patch for that.
> > Someone should look in more depth at what that's doing wrt the delay
> > parameter.
> 
> We use upstart instances for the containers so they show up in "initctl
> list" as separate jobs which can be stopped or restarted.
> 
> The upstart job calls lxc-autostart in list mode which will spit out the
> order in which the containers would be started, for each of those there
> are two columns, the first is the container name, the second is the
> delay.
> 
> The job then does "(start lxc-instance NAME=$1 && sleep $2) || true"
> which will trigger the instance and wait for the delay before moving on.
> 
> 
> I haven't looked at the rest of your change yet, but assuming you added
> the "empty" value to lxc-autostart as we suggested earlier, it should
> just be a matter of replacing "lxc-autostart -L" by "lxc-autostart -L -g
> ,boot".

Just went and looked at the submitted patch now (sorry), so yeah, two
loops in the upstart job should do the trick.

onboot seems reasonable as a name, it may be worth documenting it
somewhere though, probably in lxc.container.conf in the lxc.group
section.

> 
> > 
> > Regards,
> > Mike
> > 
> > > > > ---
> > > > >  config/init/sysvinit/lxc.in | 3 +++
> > > > >  1 file changed, 3 insertions(+)
> > > > > 
> > > > > diff --git a/config/init/sysvinit/lxc.in b/config/init/sysvinit/lxc.in
> > > > > index b1a725c..0b802af 100644
> > > > > --- a/config/init/sysvinit/lxc.in
> > > > > +++ b/config/init/sysvinit/lxc.in
> > > > > @@ -64,6 +64,9 @@ case "$1" in
> > > > >  
> > > > >  	# Start containers
> > > > >  	wait_for_bridge
> > > > > +	# Start autoboot containers first.
> > > > > +	action $"Starting LXC onboot containers: " /usr/bin/lxc-autostart -g onboot
> > > > > +	# Start NULL group containers last.
> > > > >  	action $"Starting LXC containers: " "$bindir"/lxc-autostart
> > > > >  	touch "$localstatedir"/lock/subsys/lxc
> > > > >  	;;
> > > > > -- 
> > > > > 1.9.0
> > > > > 
> > > > > 
> > > > > 
> > > > > -- 
> > > > > Michael H. Warfield (AI4NB) | (770) 978-7061 |  mhw at WittsEnd.com
> > > > >    /\/\|=mhw=|\/\/          | (678) 463-0932 |  http://www.wittsend.com/mhw/
> > > > >    NIC whois: MHW9          | An optimist believes we live in the best of all
> > > > >  PGP Key: 0x674627FF        | possible worlds.  A pessimist is sure of it!
> > > > > 
> > > > 
> > > > 
> > > > 
> > > > > _______________________________________________
> > > > > lxc-devel mailing list
> > > > > lxc-devel at lists.linuxcontainers.org
> > > > > http://lists.linuxcontainers.org/listinfo/lxc-devel
> > > > 
> > > > _______________________________________________
> > > > lxc-devel mailing list
> > > > lxc-devel at lists.linuxcontainers.org
> > > > http://lists.linuxcontainers.org/listinfo/lxc-devel
> > > > 
> > > 
> > 
> > -- 
> > Michael H. Warfield (AI4NB) | (770) 978-7061 |  mhw at WittsEnd.com
> >    /\/\|=mhw=|\/\/          | (678) 463-0932 |  http://www.wittsend.com/mhw/
> >    NIC whois: MHW9          | An optimist believes we live in the best of all
> >  PGP Key: 0x674627FF        | possible worlds.  A pessimist is sure of it!
> > 
> 
> 
> 
> > _______________________________________________
> > lxc-devel mailing list
> > lxc-devel at lists.linuxcontainers.org
> > http://lists.linuxcontainers.org/listinfo/lxc-devel
> 
> 
> -- 
> Stéphane Graber
> Ubuntu developer
> http://www.ubuntu.com



> _______________________________________________
> lxc-devel mailing list
> lxc-devel at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-devel


-- 
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20140502/c23b0c3b/attachment-0001.sig>


More information about the lxc-devel mailing list