3
0
Fork 0
forked from mirrors/nixpkgs

Fix the LVM installer test

GRUB 2 doesn't want to boot off a LVM disk:

machine# installing the GRUB 2 boot loader on /dev/vda...
machine# Path `/boot/grub' is not readable by GRUB on boot. Installation is impossible. Aborting.
machine# /nix/store/7yc535h1lim1a5gkhjb3fr6c8193dv8w-install-grub.pl: installation of GRUB on /dev/vda failed

In theory GRUB 2 supports booting from LVM, but we probably need to
generate the right grub.conf (see
https://wiki.archlinux.org/index.php/GRUB2#LVM).

http://hydra.nixos.org/build/2904680
This commit is contained in:
Eelco Dolstra 2012-07-26 15:52:05 -04:00
parent 1a2b3cc5e4
commit 87ae768665
2 changed files with 13 additions and 10 deletions

View file

@ -29,10 +29,9 @@ sub new {
$startCommand =
"qemu-kvm -m 384 " .
"-net nic,model=virtio \$QEMU_OPTS ";
my $iface = $args->{hdaInterface} or "virtio";
my $iface = $args->{hdaInterface} || "virtio";
$startCommand .= "-drive file=" . Cwd::abs_path($args->{hda}) . ",if=$iface,boot=on,werror=report "
if defined $args->{hda};
$startCommand .= "-cdrom $args->{cdrom} "
if defined $args->{cdrom};
$startCommand .= $args->{qemuFlags} || "";

View file

@ -47,7 +47,7 @@ let
''}
boot.loader.grub.device = "${grubDevice}";
boot.loader.grub.extraConfig = "serial; terminal_output.serial";
boot.initrd.kernelModules = [ "ext3" "virtio_console" ];
boot.initrd.kernelModules = [ "ext3" "ext4" "xfs" "virtio_console" ];
fileSystems = [ ${fileSystems} ];
swapDevices = [ { label = "swap"; } ];
@ -187,7 +187,7 @@ let
# And just to be sure, check that the machine still boots after
# "nixos-rebuild switch".
my $machine = createMachine({ hda => "harddisk" });
my $machine = createMachine({ hda => "harddisk", hdaInterface => "${iface}" });
$machine->waitForJob("network-interfaces");
$machine->shutdown;
'';
@ -250,28 +250,32 @@ in {
};
# Create two physical LVM partitions combined into one volume group
# that contains the logical swap and root partitions.
# that contains the logical swap and root partitions. Uses a
lvm = makeTest
{ createPartitions =
''
$machine->mustSucceed(
"parted /dev/vda mklabel msdos",
"parted /dev/vda -- mkpart primary 1M 2048M", # first PV
"parted /dev/vda -- mkpart primary ext2 1M 30MB", # /boot
"parted /dev/vda -- mkpart primary 31M 2048M", # first PV
"parted /dev/vda -- set 1 lvm on",
"parted /dev/vda -- mkpart primary 2048M -1s", # second PV
"parted /dev/vda -- set 2 lvm on",
"udevadm settle",
"pvcreate /dev/vda1 /dev/vda2",
"vgcreate MyVolGroup /dev/vda1 /dev/vda2",
"pvcreate /dev/vda2 /dev/vda3",
"vgcreate MyVolGroup /dev/vda2 /dev/vda3",
"lvcreate --size 1G --name swap MyVolGroup",
"lvcreate --size 2G --name nixos MyVolGroup",
"mkswap -f /dev/MyVolGroup/swap -L swap",
"swapon -L swap",
"mkfs.ext3 -L nixos /dev/MyVolGroup/nixos",
"mkfs.xfs -L nixos /dev/MyVolGroup/nixos",
"mount LABEL=nixos /mnt",
"mkfs.ext4 -L boot /dev/vda1",
"mkdir /mnt/boot",
"mount LABEL=boot /mnt/boot",
);
'';
fileSystems = rootFS;
fileSystems = rootFS + bootFS;
};
swraid = makeTest