From d2144755a41be5e6c866686aabbfb0d4dd79392c Mon Sep 17 00:00:00 2001 From: Andrew Childs Date: Sun, 21 Jul 2019 14:07:37 +0900 Subject: [PATCH] nixos-test-driver: allow configuration of net frontend and backend When IPXE tests were added, an option was added for configuring only the frontend, and the backend configuration was dropped entirely. This caused most installer tests to fail. --- nixos/lib/test-driver/Machine.pm | 15 ++++++++++----- nixos/tests/boot.nix | 5 +++-- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/nixos/lib/test-driver/Machine.pm b/nixos/lib/test-driver/Machine.pm index 5e4c14e749f..4d3d63cd2db 100644 --- a/nixos/lib/test-driver/Machine.pm +++ b/nixos/lib/test-driver/Machine.pm @@ -31,12 +31,17 @@ sub new { if (!$startCommand) { # !!! merge with qemu-vm.nix. - my $netArgs = ""; - $netArgs .= ",romfile=$args->{netRomFile}" - if defined $args->{netRomFile}; + my $netBackend = "-netdev user,id=net0"; + my $netFrontend = "-device virtio-net-pci,netdev=net0"; + + $netBackend .= "," . $args->{netBackendArgs} + if defined $args->{netBackendArgs}; + + $netFrontend .= "," . $args->{netFrontendArgs} + if defined $args->{netFrontendArgs}; + $startCommand = - "qemu-kvm -m 384 " . - "-device virtio-net-pci,netdev=net0${netArgs} \$QEMU_OPTS "; + "qemu-kvm -m 384 $netBackend $netFrontend \$QEMU_OPTS "; if (defined $args->{hda}) { if ($args->{hdaInterface} eq "scsi") { diff --git a/nixos/tests/boot.nix b/nixos/tests/boot.nix index 12a34d4401f..7d1b393da1e 100644 --- a/nixos/tests/boot.nix +++ b/nixos/tests/boot.nix @@ -61,7 +61,8 @@ let ]; }; machineConfig = perlAttrs ({ - qemuFlags = "-boot order=n -netdev user,id=net0,tftp=${ipxeBootDir}/,bootfile=netboot.ipxe -m 2000"; + qemuFlags = "-boot order=n -m 2000"; + netBackendArgs = "tftp=${ipxeBootDir},bootfile=netboot.ipxe"; } // extraConfig); in makeTest { @@ -100,6 +101,6 @@ in { uefiNetboot = makeNetbootTest "uefi" { bios = ''"${pkgs.OVMF.fd}/FV/OVMF.fd"''; # Custom ROM is needed for EFI PXE boot. I failed to understand exactly why, because QEMU should still use iPXE for EFI. - netRomFile = ''"${pkgs.ipxe}/ipxe.efirom"''; + netFrontendArgs = ''romfile="${pkgs.ipxe}/ipxe.efirom"''; }; }