summary refs log tree commit diff
path: root/nixos/modules/virtualisation
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-08-13 00:45:36 +0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-08-18 17:14:55 +0200
commit11d99048c1dc992a68579da7a2958ec57e718ac1 (patch)
treebcabf20c41400d07eabd5d78318f359190e2a119 /nixos/modules/virtualisation
parentceb67cc9ef9c4e2e825a2a192c564e8208e263eb (diff)
downloadnixlib-11d99048c1dc992a68579da7a2958ec57e718ac1.tar
nixlib-11d99048c1dc992a68579da7a2958ec57e718ac1.tar.gz
nixlib-11d99048c1dc992a68579da7a2958ec57e718ac1.tar.bz2
nixlib-11d99048c1dc992a68579da7a2958ec57e718ac1.tar.lz
nixlib-11d99048c1dc992a68579da7a2958ec57e718ac1.tar.xz
nixlib-11d99048c1dc992a68579da7a2958ec57e718ac1.tar.zst
nixlib-11d99048c1dc992a68579da7a2958ec57e718ac1.zip
Containers: Use systemd-nspawn startup notification
Diffstat (limited to 'nixos/modules/virtualisation')
-rw-r--r--nixos/modules/virtualisation/containers.nix14
1 files changed, 8 insertions, 6 deletions
diff --git a/nixos/modules/virtualisation/containers.nix b/nixos/modules/virtualisation/containers.nix
index 21ef0d0ff966..99329c1f1dda 100644
--- a/nixos/modules/virtualisation/containers.nix
+++ b/nixos/modules/virtualisation/containers.nix
@@ -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.