diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2015-06-17 15:40:46 +0200 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2015-06-17 15:47:43 +0200 |
commit | f93d8425c3897467798742d5f9ba871dca4a8e47 (patch) | |
tree | 2c1849bd21bfc1e934a0080ef8a1b8afcc63589f /nixos/modules/virtualisation/qemu-vm.nix | |
parent | 6563dd251fee81b50f5c27bc6e44c91829b51649 (diff) | |
download | nixlib-f93d8425c3897467798742d5f9ba871dca4a8e47.tar nixlib-f93d8425c3897467798742d5f9ba871dca4a8e47.tar.gz nixlib-f93d8425c3897467798742d5f9ba871dca4a8e47.tar.bz2 nixlib-f93d8425c3897467798742d5f9ba871dca4a8e47.tar.lz nixlib-f93d8425c3897467798742d5f9ba871dca4a8e47.tar.xz nixlib-f93d8425c3897467798742d5f9ba871dca4a8e47.tar.zst nixlib-f93d8425c3897467798742d5f9ba871dca4a8e47.zip |
Installer test: Fix booting from SCSI
This is required by the GRUB 1 test.
Diffstat (limited to 'nixos/modules/virtualisation/qemu-vm.nix')
-rw-r--r-- | nixos/modules/virtualisation/qemu-vm.nix | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/nixos/modules/virtualisation/qemu-vm.nix b/nixos/modules/virtualisation/qemu-vm.nix index dcb498493fa2..15b0da3bab74 100644 --- a/nixos/modules/virtualisation/qemu-vm.nix +++ b/nixos/modules/virtualisation/qemu-vm.nix @@ -62,7 +62,7 @@ let extraDisks="" ${flip concatMapStrings cfg.emptyDiskImages (size: '' ${pkgs.qemu_kvm}/bin/qemu-img create -f qcow2 "empty$idx.qcow2" "${toString size}M" - extraDisks="$extraDisks -drive index=$idx,file=$(pwd)/empty$idx.qcow2,if=virtio,werror=report" + extraDisks="$extraDisks -drive index=$idx,file=$(pwd)/empty$idx.qcow2,if=${cfg.qemu.diskInterface},werror=report" idx=$((idx + 1)) '')} @@ -76,14 +76,14 @@ let -virtfs local,path=$TMPDIR/xchg,security_model=none,mount_tag=xchg \ -virtfs local,path=''${SHARED_DIR:-$TMPDIR/xchg},security_model=none,mount_tag=shared \ ${if cfg.useBootLoader then '' - -drive index=0,id=drive1,file=$NIX_DISK_IMAGE,if=virtio,cache=writeback,werror=report \ + -drive index=0,id=drive1,file=$NIX_DISK_IMAGE,if=${cfg.qemu.diskInterface},cache=writeback,werror=report \ -drive index=1,id=drive2,file=$TMPDIR/disk.img,media=disk \ ${if cfg.useEFIBoot then '' -pflash $TMPDIR/bios.bin \ '' else '' ''} '' else '' - -drive index=0,id=drive1,file=$NIX_DISK_IMAGE,if=virtio,cache=writeback,werror=report \ + -drive index=0,id=drive1,file=$NIX_DISK_IMAGE,if=${cfg.qemu.diskInterface},cache=writeback,werror=report \ -kernel ${config.system.build.toplevel}/kernel \ -initrd ${config.system.build.toplevel}/initrd \ -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 virtualisation.bootDevice = mkOption { type = types.str; - default = "/dev/vda"; + example = "/dev/vda"; description = '' The disk to be used for the root filesystem. @@ -318,6 +318,17 @@ in to keep the default runtime behaviour. ''; }; + + diskInterface = + mkOption { + default = "virtio"; + example = "scsi"; + type = types.str; + description = '' + The interface used for the virtual hard disks + (<literal>virtio</literal> or <literal>scsi</literal>). + ''; + }; }; virtualisation.useBootLoader = @@ -393,6 +404,12 @@ in fi ''; + boot.initrd.availableKernelModules = + optional (cfg.qemu.diskInterface == "scsi") "sym53c8xx"; + + virtualisation.bootDevice = + mkDefault (if cfg.qemu.diskInterface == "scsi" then "/dev/sda" else "/dev/vda"); + virtualisation.pathsInNixDB = [ config.system.build.toplevel ]; virtualisation.qemu.options = [ "-vga std" "-usbdevice tablet" ]; |