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.
This commit is contained in:
Andrew Childs 2019-07-21 14:07:37 +09:00 committed by Nikolay Amiantov
parent b93b7d292a
commit d2144755a4
2 changed files with 13 additions and 7 deletions

View File

@ -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") {

View File

@ -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"'';
};
}