git.iko.soy/typeable/nixpkgs
on master help sign in
Installer test: Fix booting from SCSI

This is required by the GRUB 1 test.

commitf93d8425c3897467798742d5f9ba871dca4a8e47 authorEelco Dolstra <eelco.dolstra@logicblox.com> dateWed 17 Jun 2015, 15:40 (11 years ago) parent6563dd2
2 files changed+25−5
nixos/modules/virtualisation/qemu-vm.nix+21−4 nixos/tests/installer.nix+4−1
nixos/modules/virtualisation/qemu-vm.nix+21−4
@@ -62,7 +62,7 @@ let
6262 extraDisks=""
6363 ${flip concatMapStrings cfg.emptyDiskImages (size: ''
6464 ${pkgs.qemu_kvm}/bin/qemu-img create -f qcow2 "empty$idx.qcow2" "${toString size}M"
65− extraDisks="$extraDisks -drive index=$idx,file=$(pwd)/empty$idx.qcow2,if=virtio,werror=report"
65+ extraDisks="$extraDisks -drive index=$idx,file=$(pwd)/empty$idx.qcow2,if=${cfg.qemu.diskInterface},werror=report"
6666 idx=$((idx + 1))
6767 '')}
6868
@@ -76,14 +76,14 @@ let
7676 -virtfs local,path=$TMPDIR/xchg,security_model=none,mount_tag=xchg \
7777 -virtfs local,path=''${SHARED_DIR:-$TMPDIR/xchg},security_model=none,mount_tag=shared \
7878 ${if cfg.useBootLoader then ''
79− -drive index=0,id=drive1,file=$NIX_DISK_IMAGE,if=virtio,cache=writeback,werror=report \
79+ -drive index=0,id=drive1,file=$NIX_DISK_IMAGE,if=${cfg.qemu.diskInterface},cache=writeback,werror=report \
8080 -drive index=1,id=drive2,file=$TMPDIR/disk.img,media=disk \
8181 ${if cfg.useEFIBoot then ''
8282 -pflash $TMPDIR/bios.bin \
8383 '' else ''
8484 ''}
8585 '' else ''
86− -drive index=0,id=drive1,file=$NIX_DISK_IMAGE,if=virtio,cache=writeback,werror=report \
86+ -drive index=0,id=drive1,file=$NIX_DISK_IMAGE,if=${cfg.qemu.diskInterface},cache=writeback,werror=report \
8787 -kernel ${config.system.build.toplevel}/kernel \
8888 -initrd ${config.system.build.toplevel}/initrd \
8989 -append "$(cat ${config.system.build.toplevel}/kernel-params) init=${config.system.build.toplevel}/init regInfo=${regInfo} ${kernelConsole} $QEMU_KERNEL_PARAMS" \
@@ -207,7 +207,7 @@ in
207207 virtualisation.bootDevice =
208208 mkOption {
209209 type = types.str;
210− default = "/dev/vda";
210+ example = "/dev/vda";
211211 description =
212212 ''
213213 The disk to be used for the root filesystem.
@@ -318,6 +318,17 @@ in
318318 to keep the default runtime behaviour.
319319 '';
320320 };
321+
322+ diskInterface =
323+ mkOption {
324+ default = "virtio";
325+ example = "scsi";
326+ type = types.str;
327+ description = ''
328+ The interface used for the virtual hard disks
329+ (<literal>virtio</literal> or <literal>scsi</literal>).
330+ '';
331+ };
321332 };
322333
323334 virtualisation.useBootLoader =
@@ -393,6 +404,12 @@ in
393404 fi
394405 '';
395406
407+ boot.initrd.availableKernelModules =
408+ optional (cfg.qemu.diskInterface == "scsi") "sym53c8xx";
409+
410+ virtualisation.bootDevice =
411+ mkDefault (if cfg.qemu.diskInterface == "scsi" then "/dev/sda" else "/dev/vda");
412+
396413 virtualisation.pathsInNixDB = [ config.system.build.toplevel ];
397414
398415 virtualisation.qemu.options = [ "-vga std" "-usbdevice tablet" ];
nixos/tests/installer.nix+4−1
@@ -175,7 +175,10 @@ let
175175 # installer. This ensures the target disk (/dev/vda) is
176176 # the same during and after installation.
177177 virtualisation.emptyDiskImages = [ 512 ];
178− virtualisation.bootDevice = "/dev/vdb";
178+ virtualisation.bootDevice =
179+ if grubVersion == 1 then "/dev/sdb" else "/dev/vdb";
180+ virtualisation.qemu.diskInterface =
181+ if grubVersion == 1 then "scsi" else "virtio";
179182
180183 hardware.enableAllFirmware = mkForce false;
181184