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:
parent
aa075f089e
commit
9704472d1c
@ -69,7 +69,12 @@ let
|
|||||||
for mp in $(getMountPoints); do
|
for mp in $(getMountPoints); do
|
||||||
device=$(getDevice $mp)
|
device=$(getDevice $mp)
|
||||||
echo "unmounting $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
|
if test "$mp" != /; then tryAgain=1; fi
|
||||||
else
|
else
|
||||||
mount -n -o remount,ro "$mp" || true
|
mount -n -o remount,ro "$mp" || true
|
||||||
|
@ -159,10 +159,10 @@ in
|
|||||||
respawn sleep 100000
|
respawn sleep 100000
|
||||||
|
|
||||||
stop script
|
stop script
|
||||||
for i in $(cd /sys/class/net && ls -d *); do
|
#for i in $(cd /sys/class/net && ls -d *); do
|
||||||
echo "Taking down network device $i..."
|
# echo "Taking down network device $i..."
|
||||||
${nettools}/sbin/ifconfig $i down || true
|
# ${nettools}/sbin/ifconfig $i down || true
|
||||||
done
|
#done
|
||||||
end script
|
end script
|
||||||
'';
|
'';
|
||||||
}];
|
}];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user