From ec33622b48d33497caf9bc81e5df7f16bc94c29a Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sun, 16 May 2010 20:44:45 +0000 Subject: [PATCH] * A test for installing NixOS on software RAID. Doesn't quite work yet though - GRUB fails mysteriously on the second reboot. svn path=/nixos/trunk/; revision=21808 --- release.nix | 1 + tests/installer.nix | 29 +++++++++++++++++++++++++++-- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/release.nix b/release.nix index eb9fb3731f7..6f9adbc3843 100644 --- a/release.nix +++ b/release.nix @@ -152,6 +152,7 @@ let installer.lvm = t.installer.lvm.test; installer.separateBoot = t.installer.separateBoot.test; installer.simple = t.installer.simple.test; + installer.swraid = t.installer.swraid.test; kde4 = t.kde4.test; login = t.login.test; openssh = t.openssh.test; diff --git a/tests/installer.nix b/tests/installer.nix index 10ac14332b0..26423cd9d06 100644 --- a/tests/installer.nix +++ b/tests/installer.nix @@ -173,7 +173,7 @@ let # Did /boot get mounted, if appropriate? # !!! There is currently no good way to wait for the - # `filesystems' tash to finish. + # `filesystems' task to finish. $machine->waitForFile("/boot/grub/grub.cfg"); # Did the swap device get activated? @@ -209,6 +209,9 @@ let in { + # !!! `parted mkpart' seems to silently create overlapping partitions. + + # The (almost) simplest partitioning scheme: a swap partition and # one big filesystem partition. simple = makeTest @@ -282,5 +285,27 @@ in { ''; fileSystems = rootFS; }; - + + swraid = makeTest + { createPartitions = + '' + $machine->mustSucceed( + "parted /dev/vda mklabel msdos", + "parted /dev/vda -- mkpart primary 1M 1000M", # md0 (root), first device + "parted /dev/vda -- mkpart primary 1024M 2024M", # md0 (root), second device + "parted /dev/vda -- mkpart primary 2048M 2548M", # md1 (swap), first device + "parted /dev/vda -- mkpart primary 2560M 3060M", # md1 (swap), second device + "udevadm settle", + # Note that GRUB2 doesn't work with version 1.2 metadata. + "mdadm --create --force /dev/md0 --metadata 0.90 --level=raid1 --raid-devices=2 /dev/vda1 /dev/vda2", + "mdadm --create --force /dev/md1 --metadata 1.2 --level=raid1 --raid-devices=2 /dev/vda3 /dev/vda4", + "mkswap -f /dev/md1 -L swap", + "swapon -L swap", + "mkfs.ext3 -L nixos /dev/md0", + "mount LABEL=nixos /mnt", + ); + ''; + fileSystems = rootFS; + }; + }