mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-12 05:16:25 +03:00
Containers: Use systemd-nspawn startup notification
This prevents the container unit startup from hanging until timeout if systemd-nspawn fails.
This commit is contained in:
parent
ab402dc1a4
commit
330fadb706
1 changed files with 8 additions and 6 deletions
|
@ -228,12 +228,6 @@ in
|
||||||
|
|
||||||
postStart =
|
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
|
if [ "$PRIVATE_NETWORK" = 1 ]; then
|
||||||
ifaceHost=ve-$INSTANCE
|
ifaceHost=ve-$INSTANCE
|
||||||
ip link set dev $ifaceHost up
|
ip link set dev $ifaceHost up
|
||||||
|
@ -244,6 +238,12 @@ in
|
||||||
ip route add $LOCAL_ADDRESS dev $ifaceHost
|
ip route add $LOCAL_ADDRESS dev $ifaceHost
|
||||||
fi
|
fi
|
||||||
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 =
|
preStop =
|
||||||
|
@ -267,6 +267,8 @@ in
|
||||||
|
|
||||||
EnvironmentFile = "-/etc/containers/%i.conf";
|
EnvironmentFile = "-/etc/containers/%i.conf";
|
||||||
|
|
||||||
|
Type = "notify";
|
||||||
|
|
||||||
# Note that on reboot, systemd-nspawn returns 10, so this
|
# Note that on reboot, systemd-nspawn returns 10, so this
|
||||||
# unit will be restarted. On poweroff, it returns 0, so the
|
# unit will be restarted. On poweroff, it returns 0, so the
|
||||||
# unit won't be restarted.
|
# unit won't be restarted.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue