Some hacks to support clean shutdowns of VMs that mount the Nix store

ove QEMU (and other NixOS instances that use a remote filesystem like
NFS):

* Don't take down the network interfaces during shutdown.
* Don't try to unmount the Nix store.  Usually, this doesn't work
  because it's still in use, but on remote filesystems like CIFS the
  `-f' umount flag actually works.

svn path=/nixos/branches/modular-nixos/; revision=16036
This commit is contained in:
Eelco Dolstra 2009-06-24 13:33:03 +00:00
parent aa075f089e
commit 9704472d1c
2 changed files with 10 additions and 5 deletions

View file

@ -69,7 +69,12 @@ let
for mp in $(getMountPoints); do
device=$(getDevice $mp)
echo "unmounting $mp..."
if umount -f -n "$mp"; then
# !!! Don't unmount /nix/store or /hostfs. This is
# a quick hack to cleanly shutdown VMs that mount
# the Nix store via CIFS. "mount -f" will actually
# work on such filesystems, which makes all commands
# needed below disappear.
if test "$mp" != /nix/store -a "$mp" != /hostfs && umount -f -n "$mp"; then
if test "$mp" != /; then tryAgain=1; fi
else
mount -n -o remount,ro "$mp" || true

View file

@ -159,10 +159,10 @@ in
respawn sleep 100000
stop script
for i in $(cd /sys/class/net && ls -d *); do
echo "Taking down network device $i..."
${nettools}/sbin/ifconfig $i down || true
done
#for i in $(cd /sys/class/net && ls -d *); do
# echo "Taking down network device $i..."
# ${nettools}/sbin/ifconfig $i down || true
#done
end script
'';
}];