[lxc-devel] [PATCH] fix systemd lxc-net vs lxc ordering

Serge Hallyn serge.hallyn at ubuntu.com
Mon Jun 29 17:23:13 UTC 2015


Quoting Serge Hallyn (serge.hallyn at ubuntu.com):
> Quoting Serge Hallyn (serge.hallyn at ubuntu.com):
> > The lxc init job must not start until lxc networking has been
> > setup.  This requires lxc-net to have complete, not just
> > started.  To that end,
> > 
> > 1. lxc-net now does its work in ExecPreStart rather than
> > ExecStart
> > 
> > 2. lxc now specifies lxc-net in After, not Wants.  So if lxc-net
> > fails, lxc won't start and try to autostart containers.  (If you
> > want lxc-net to do nothing, setting USE_LXC_BRIDGE="false" in
> > /etc/default/lxc is the way to do that, but lxc-net should still
> > run successfully.)
> > 
> > Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>
> 
> self-nack.  From http://www.freedesktop.org/software/systemd/man/systemd.service.html:
> 
> "Note that ExecStartPre= may not be used to start long-running processes. All processes forked off by processes invoked via ExecStartPre= will be killed before the next service process is run."
> 
> So this won't suffice.

I don't see a good way to have the systemd primitives do this for
us.  It will kill anything started in an ExecStartPre, but it
won't wait until ExecStart is done to start the services waiting on
it.


So it seems there are two options here,

1. just unify the lxc-net and lxc scripts and update all init jobs

2. have lxc-net touch /run/lxc/lxc-net.done when ready (and
rm it when done), and have lxc wait until that exists to
run.

Martin, Stéphane, any thoughts?

-serge


More information about the lxc-devel mailing list