[lxc-devel] [PATCH 3/6] Add systemd unit for lxc.net
Michael H. Warfield
mhw at WittsEnd.com
Sat Aug 9 13:27:54 UTC 2014
On Thu, 2014-07-31 at 08:53 +0200, Martin Pitt wrote:
> This is the equivalent of the upstart lxc-net.conf to set up the LXC bridge.
> This also drops "lxc.service" from tarballs. It is built source which depends
> on configure options, so the statically shipped file will not work on most
> systems.
Looks like this patch missed adding lxc.net to lxc.spec for rpm
builds. :-P "make rpm" for 1.1.0-alpha1 is failing on Fedora 20.
Looking into this now.
> https://launchpad.net/bugs/1312532
> ---
> .gitignore | 1 +
> config/init/systemd/Makefile.am | 11 +++++++----
> config/init/systemd/lxc-net.service.in | 10 ++++++++++
> config/init/systemd/lxc.service.in | 1 +
> configure.ac | 1 +
> 5 files changed, 20 insertions(+), 4 deletions(-)
> create mode 100644 config/init/systemd/lxc-net.service.in
>
> diff --git a/.gitignore b/.gitignore
> index 26011e4..e6de18f 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -114,6 +114,7 @@ config/lt*.m4
> config/bash/lxc
> config/init/systemd/lxc-autostart-helper
> config/init/systemd/lxc.service
> +config/init/systemd/lxc-net.service
> config/init/sysvinit/lxc
>
> doc/*.1
> diff --git a/config/init/systemd/Makefile.am b/config/init/systemd/Makefile.am
> index 3bd221f..ed1e4ef 100644
> --- a/config/init/systemd/Makefile.am
> +++ b/config/init/systemd/Makefile.am
> @@ -1,6 +1,8 @@
> EXTRA_DIST = \
> lxc-devsetup \
> - lxc.service
> + lxc.service.in \
> + lxc-net.service.in \
> + $(NULL)
>
> if INIT_SCRIPT_SYSTEMD
> lxc-autostart-helper: ../sysvinit/lxc.in $(top_builddir)/config.status
> @@ -11,14 +13,15 @@ lxc-autostart-helper: ../sysvinit/lxc.in $(top_builddir)/config.status
> < $< > $@-t && \
> chmod a+x $@-t && \
> mv $@-t $@
> -BUILT_SOURCES = lxc-autostart-helper
> +BUILT_SOURCES = lxc-autostart-helper lxc.service lxc-net.service
>
> -install-systemd: lxc.service lxc-devsetup lxc-autostart-helper
> +install-systemd: lxc.service lxc-net.service lxc-devsetup lxc-autostart-helper
> $(MKDIR_P) $(DESTDIR)$(SYSTEMD_UNIT_DIR)
> - $(INSTALL_DATA) lxc.service $(DESTDIR)$(SYSTEMD_UNIT_DIR)/
> + $(INSTALL_DATA) lxc.service lxc-net.service $(DESTDIR)$(SYSTEMD_UNIT_DIR)/
>
> uninstall-systemd:
> rm -f $(DESTDIR)$(SYSTEMD_UNIT_DIR)/lxc.service
> + rm -f $(DESTDIR)$(SYSTEMD_UNIT_DIR)/lxc-net.service
> rmdir $(DESTDIR)$(SYSTEMD_UNIT_DIR) || :
>
> pkglibexec_SCRIPTS = lxc-devsetup lxc-autostart-helper
> diff --git a/config/init/systemd/lxc-net.service.in b/config/init/systemd/lxc-net.service.in
> new file mode 100644
> index 0000000..37d1d69
> --- /dev/null
> +++ b/config/init/systemd/lxc-net.service.in
> @@ -0,0 +1,10 @@
> +[Unit]
> +Description=LXC network bridge setup
> +After=network.target
> +Before=lxc.service
> +
> +[Service]
> +Type=oneshot
> +RemainAfterExit=yes
> +ExecStart=@DATADIR@/lxc/lxc.net start
> +ExecStop=@DATADIR@/lxc/lxc.net stop
> diff --git a/config/init/systemd/lxc.service.in b/config/init/systemd/lxc.service.in
> index 0a428a3..c7f2813 100644
> --- a/config/init/systemd/lxc.service.in
> +++ b/config/init/systemd/lxc.service.in
> @@ -1,6 +1,7 @@
> [Unit]
> Description=LXC Container Initialization and Autoboot Code
> After=syslog.target network.target
> +Wants=lxc-net.service
>
> [Service]
> Type=oneshot
> diff --git a/configure.ac b/configure.ac
> index ded4c48..c0d7015 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -613,6 +613,7 @@ AC_CONFIG_FILES([
> config/init/sysvinit/lxc
> config/init/systemd/Makefile
> config/init/systemd/lxc.service
> + config/init/systemd/lxc-net.service
> config/init/upstart/Makefile
> config/etc/Makefile
> config/templates/Makefile
> --
> 2.0.1
>
> _______________________________________________
> 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!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 465 bytes
Desc: This is a digitally signed message part
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20140809/876d8463/attachment.sig>
More information about the lxc-devel
mailing list