nixpkgs/nixos/lib
aszlig f148c5c4a1
nixos/tests: Fix QEMU flags for SCSI disks
The ability to specify "-drive if=scsi" has been removed in QEMU version
2.12 (introduced in 3e3b39f173).

Quote from https://wiki.qemu.org/ChangeLog/2.12#Incompatible_changes:

> The deprecated way of configuring SCSI devices with "-drive if=scsi"
> on x86 has been removed. Use an appropriate SCSI controller together
> "-device scsi-hd" or "-device scsi-cd" and a corresponding "-blockdev"
> parameter instead.

So whenever the diskInterface is "scsi" we use the new way to specify
the drive and fall back to the deprecated way for the time being. The
reason why I'm not using the new way for "virtio" and "ide" as well is
because there is no simple generic way anymore to specify these.

This also turns the type of the virtualisation.qemu.diskInterface option
to be an enum, so the user knows which values are allowed but we can
also make sure the right value is provided to prevent typos.

I've tested this against a few non-disk-related NixOS VM tests but also
the installer.grub1 test (because it uses "ide" as its drive interface),
the installer.simple test (just to be sure it still works with
"virtio") and all the tests in nixos/tests/boot.nix.

In order to be able to run the grub1 test I had to go back to
8b1cf100cd (which is a known commit where
that test still works) and apply the QEMU update and this very commit,
because right now the test is broken.

Apart from the tests here in nixpkgs, I also ran another[1] test in
another repository which uses the "scsi" disk interface as well (in
comparison to most of the installer tests, this one actually failed
prior to this commit).

All of them now succeed.

[1]: 9b5a119972/tests/system/kernel/bfq.nix

Signed-off-by: aszlig <aszlig@nix.build>
Cc: @edostra, @grahamc, @dezgeg, @abbradar, @ts468
2018-04-30 03:02:59 +02:00
..
test-driver nixos/tests: Fix QEMU flags for SCSI disks 2018-04-30 03:02:59 +02:00
testing
build-vms.nix
eval-config.nix nixpkgs module: Clean up platform options 2018-04-06 12:41:44 -04:00
from-env.nix
make-channel.nix
make-disk-image.nix
make-ext4-fs.nix nixos/make-ext4-fs: Use closureInfo 2018-04-10 00:31:36 +03:00
make-iso9660-image.nix
make-iso9660-image.sh
make-squashfs.nix
make-system-tarball.nix make-system-tarball: allow alternate compression methods 2018-04-03 11:30:43 -03:00
make-system-tarball.sh make-system-tarball: allow alternate compression methods 2018-04-03 11:30:43 -03:00
qemu-flags.nix treewide: isArm -> isAarch32 2018-04-25 15:28:55 -04:00
testing.nix nixos testing: significantly reduce deps needed for OCR tests 2018-03-31 00:24:15 -05:00
utils.nix