Use only one build of qemu in VM tests

Previously we were using two or three (qemu_kvm, qemu_test, and
qemu_test with a different dbus when minimal.nix is included).

(cherry picked from commit 8bfa4ce82ea7d23a1d4c6073bcc044e6bf9c4dbe)

+11 -6
+3
nixos/lib/build-vms.nix
··· 9 9 10 10 inherit pkgs; 11 11 12 + qemu = pkgs.qemu_test; 13 + 12 14 13 15 # Build a virtual network from an attribute set `{ machine1 = 14 16 # config1; ... machineN = configN; }', where `machineX' is the ··· 27 29 [ ../modules/virtualisation/qemu-vm.nix 28 30 ../modules/testing/test-instrumentation.nix # !!! should only get added for automated test runs 29 31 { key = "no-manual"; services.nixosManual.enable = false; } 32 + { key = "qemu"; system.build.qemu = qemu; } 30 33 ] ++ optional minimal ../modules/testing/minimal-kernel.nix; 31 34 extraArgs = { inherit nodes; }; 32 35 };
+1 -1
nixos/lib/testing.nix
··· 29 29 cp ${./test-driver/Logger.pm} $libDir/Logger.pm 30 30 31 31 wrapProgram $out/bin/nixos-test-driver \ 32 - --prefix PATH : "${lib.makeBinPath [ qemu_test vde2 netpbm coreutils ]}" \ 32 + --prefix PATH : "${lib.makeBinPath [ qemu vde2 netpbm coreutils ]}" \ 33 33 --prefix PERL5LIB : "${with perlPackages; lib.makePerlPath [ TermReadLineGnu XMLWriter IOTty FileSlurp ]}:$out/lib/perl5/site_perl" 34 34 ''; 35 35 };
+7 -5
nixos/modules/virtualisation/qemu-vm.nix
··· 13 13 14 14 let 15 15 16 + qemu = config.system.build.qemu or pkgs.qemu_test; 17 + 16 18 vmName = 17 19 if config.networking.hostName == "" 18 20 then "noname" ··· 32 34 NIX_DISK_IMAGE=$(readlink -f ''${NIX_DISK_IMAGE:-${config.virtualisation.diskImage}}) 33 35 34 36 if ! test -e "$NIX_DISK_IMAGE"; then 35 - ${pkgs.qemu_kvm}/bin/qemu-img create -f qcow2 "$NIX_DISK_IMAGE" \ 37 + ${qemu}/bin/qemu-img create -f qcow2 "$NIX_DISK_IMAGE" \ 36 38 ${toString config.virtualisation.diskSize}M || exit 1 37 39 fi 38 40 ··· 47 49 ${if cfg.useBootLoader then '' 48 50 # Create a writable copy/snapshot of the boot disk. 49 51 # A writable boot disk can be booted from automatically. 50 - ${pkgs.qemu_kvm}/bin/qemu-img create -f qcow2 -b ${bootDisk}/disk.img $TMPDIR/disk.img || exit 1 52 + ${qemu}/bin/qemu-img create -f qcow2 -b ${bootDisk}/disk.img $TMPDIR/disk.img || exit 1 51 53 52 54 ${if cfg.useEFIBoot then '' 53 55 # VM needs a writable flash BIOS. ··· 63 65 extraDisks="" 64 66 ${flip concatMapStrings cfg.emptyDiskImages (size: '' 65 67 if ! test -e "empty$idx.qcow2"; then 66 - ${pkgs.qemu_kvm}/bin/qemu-img create -f qcow2 "empty$idx.qcow2" "${toString size}M" 68 + ${qemu}/bin/qemu-img create -f qcow2 "empty$idx.qcow2" "${toString size}M" 67 69 fi 68 70 extraDisks="$extraDisks -drive index=$idx,file=$(pwd)/empty$idx.qcow2,if=${cfg.qemu.diskInterface},werror=report" 69 71 idx=$((idx + 1)) 70 72 '')} 71 73 72 74 # Start QEMU. 73 - exec ${pkgs.qemu_test}/bin/qemu-kvm \ 75 + exec ${qemu}/bin/qemu-kvm \ 74 76 -name ${vmName} \ 75 77 -m ${toString config.virtualisation.memorySize} \ 76 78 ${optionalString (pkgs.stdenv.system == "x86_64-linux") "-cpu kvm64"} \ ··· 121 123 mkdir $out 122 124 diskImage=$out/disk.img 123 125 bootFlash=$out/bios.bin 124 - ${pkgs.qemu_kvm}/bin/qemu-img create -f qcow2 $diskImage "40M" 126 + ${qemu}/bin/qemu-img create -f qcow2 $diskImage "40M" 125 127 ${if cfg.useEFIBoot then '' 126 128 cp ${pkgs.OVMF-CSM}/FV/OVMF.fd $bootFlash 127 129 chmod 0644 $bootFlash