Containers: Use systemd-nspawn startup notification

This commit is contained in:
Eelco Dolstra 2014-08-13 00:45:36 +02:00
parent ceb67cc9ef
commit 11d99048c1

View File

@ -230,12 +230,6 @@ in
postStart =
''
# This blocks until the container-startup-done service
# writes something to this pipe. FIXME: it also hangs
# until the start timeout expires if systemd-nspawn exits.
read x < $root/var/lib/startup-done
rm -f $root/var/lib/startup-done
if [ "$PRIVATE_NETWORK" = 1 ]; then
ifaceHost=ve-$INSTANCE
ip link set dev $ifaceHost up
@ -246,6 +240,12 @@ in
ip route add $LOCAL_ADDRESS dev $ifaceHost
fi
fi
# This blocks until the container-startup-done service
# writes something to this pipe. FIXME: it also hangs
# until the start timeout expires if systemd-nspawn exits.
read x < $root/var/lib/startup-done
rm -f $root/var/lib/startup-done
'';
preStop =
@ -269,6 +269,8 @@ in
EnvironmentFile = "-/etc/containers/%i.conf";
Type = "notify";
# Note that on reboot, systemd-nspawn returns 10, so this
# unit will be restarted. On poweroff, it returns 0, so the
# unit won't be restarted.