From 6a140df0048c99e62339d97effbe16a1bba42d45 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 29 Dec 2014 12:38:26 +0100 Subject: units: rework systemd-nspawn@.service unit - Unescape instance name so that we can take almost anything as instance name. - Introduce "machines.target" which consists of all enabled nspawns and can be used to start/stop them altogether - Look for container directory using -M instead of harcoding the path in /var/lib/container --- units/machines.target | 17 +++++++++++++++++ units/systemd-nspawn@.service.in | 8 +++++--- 2 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 units/machines.target (limited to 'units') diff --git a/units/machines.target b/units/machines.target new file mode 100644 index 0000000000..99618a19f7 --- /dev/null +++ b/units/machines.target @@ -0,0 +1,17 @@ +# This file is part of systemd. +# +# systemd is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or +# (at your option) any later version. + +[Unit] +Description=Containers +Documentation=man:systemd.special(7) +Requires=basic.target +Conflicts=rescue.service rescue.target +After=basic.target rescue.service rescue.target +Before=multi-user.target + +[Install] +WantedBy=multi-user.target diff --git a/units/systemd-nspawn@.service.in b/units/systemd-nspawn@.service.in index e3eaa53239..02d663dd24 100644 --- a/units/systemd-nspawn@.service.in +++ b/units/systemd-nspawn@.service.in @@ -6,11 +6,13 @@ # (at your option) any later version. [Unit] -Description=Container %i +Description=Container %I Documentation=man:systemd-nspawn(1) +PartOf=machines.target +Before=machines.target [Service] -ExecStart=@bindir@/systemd-nspawn --quiet --keep-unit --boot --link-journal=try-guest --directory=/var/lib/container/%i +ExecStart=@bindir@/systemd-nspawn --quiet --keep-unit --boot --link-journal=try-guest --machine=%I KillMode=mixed Type=notify RestartForceExitStatus=133 @@ -18,4 +20,4 @@ SuccessExitStatus=133 Delegate=yes [Install] -WantedBy=multi-user.target +WantedBy=machines.target -- cgit v1.2.3-54-g00ecf