mirror of
https://pagure.io/fedora-qa/os-autoinst-distri-fedora.git
synced 2024-11-25 07:13:09 +00:00
Add PXE boot test
This adds a whole wodge of stuff to support_server to make it act as a PXE server, then adds a new test which boots from PXE and so should hit the PXE server. We use the NFS install repo as that can be relied on to work for a support_server install. Signed-off-by: Adam Williamson <awilliam@redhat.com>
This commit is contained in:
parent
a177a63ec1
commit
2f51f3ef20
16
needles/console/bootloader_bios_pxe-20190816.json
Normal file
16
needles/console/bootloader_bios_pxe-20190816.json
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"area": [
|
||||||
|
{
|
||||||
|
"xpos": 204,
|
||||||
|
"ypos": 279,
|
||||||
|
"width": 223,
|
||||||
|
"height": 20,
|
||||||
|
"type": "match"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": [],
|
||||||
|
"tags": [
|
||||||
|
"bootloader",
|
||||||
|
"bootloader_bios"
|
||||||
|
]
|
||||||
|
}
|
BIN
needles/console/bootloader_bios_pxe-20190816.png
Normal file
BIN
needles/console/bootloader_bios_pxe-20190816.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 31 KiB |
62
templates
62
templates
@ -1712,6 +1712,28 @@
|
|||||||
},
|
},
|
||||||
test_suite => { name => "install_kickstart_nfs" },
|
test_suite => { name => "install_kickstart_nfs" },
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
machine => { name => "64bit" },
|
||||||
|
prio => 30,
|
||||||
|
product => {
|
||||||
|
arch => "x86_64",
|
||||||
|
distri => "fedora",
|
||||||
|
flavor => "universal",
|
||||||
|
version => "*",
|
||||||
|
},
|
||||||
|
test_suite => { name => "install_pxeboot" },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
machine => { name => "uefi" },
|
||||||
|
prio => 31,
|
||||||
|
product => {
|
||||||
|
arch => "x86_64",
|
||||||
|
distri => "fedora",
|
||||||
|
flavor => "universal",
|
||||||
|
version => "*",
|
||||||
|
},
|
||||||
|
test_suite => { name => "install_pxeboot" },
|
||||||
|
},
|
||||||
{
|
{
|
||||||
machine => { name => "64bit" },
|
machine => { name => "64bit" },
|
||||||
prio => 30,
|
prio => 30,
|
||||||
@ -2861,6 +2883,18 @@
|
|||||||
},
|
},
|
||||||
test_suite => { name => "install_kickstart_nfs" },
|
test_suite => { name => "install_kickstart_nfs" },
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
group_name => "Fedora PowerPC",
|
||||||
|
machine => { name => "ppc64le" },
|
||||||
|
prio => 30,
|
||||||
|
product => {
|
||||||
|
arch => "ppc64le",
|
||||||
|
distri => "fedora",
|
||||||
|
flavor => "universal",
|
||||||
|
version => "*",
|
||||||
|
},
|
||||||
|
test_suite => { name => "install_pxeboot" },
|
||||||
|
},
|
||||||
{
|
{
|
||||||
group_name => "Fedora PowerPC",
|
group_name => "Fedora PowerPC",
|
||||||
machine => { name => "ppc64le" },
|
machine => { name => "ppc64le" },
|
||||||
@ -3785,6 +3819,18 @@
|
|||||||
},
|
},
|
||||||
test_suite => { name => "install_kickstart_nfs" },
|
test_suite => { name => "install_kickstart_nfs" },
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
group_name => "Fedora AArch64",
|
||||||
|
machine => { name => "aarch64" },
|
||||||
|
prio => 30,
|
||||||
|
product => {
|
||||||
|
arch => "aarch64",
|
||||||
|
distri => "fedora",
|
||||||
|
flavor => "universal",
|
||||||
|
version => "*",
|
||||||
|
},
|
||||||
|
test_suite => { name => "install_pxeboot" },
|
||||||
|
},
|
||||||
{
|
{
|
||||||
group_name => "Fedora AArch64",
|
group_name => "Fedora AArch64",
|
||||||
machine => { name => "aarch64" },
|
machine => { name => "aarch64" },
|
||||||
@ -4348,6 +4394,22 @@
|
|||||||
{ key => "WORKER_CLASS", value => "tap" },
|
{ key => "WORKER_CLASS", value => "tap" },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name => "install_pxeboot",
|
||||||
|
settings => [
|
||||||
|
# this delays VM boot so we can wait till the PXE server
|
||||||
|
# is ready
|
||||||
|
{ key => "DELAYED_START", value => "1" },
|
||||||
|
# this is to ensure the test never 'accidentally' passes
|
||||||
|
# by falling back to boot from ISO
|
||||||
|
{ key => "+ISO", value => "" },
|
||||||
|
{ key => "TEST_TARGET", value => "COMPOSE" },
|
||||||
|
{ key => "PXEBOOT", value => "once" },
|
||||||
|
{ key => "PARALLEL_WITH", value => "support_server:%ARCH_BASE_MACHINE%" },
|
||||||
|
{ key => "NICTYPE", value => "tap" },
|
||||||
|
{ key => "WORKER_CLASS", value => "tap" },
|
||||||
|
],
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name => "install_repository_hd_variation",
|
name => "install_repository_hd_variation",
|
||||||
settings => [
|
settings => [
|
||||||
|
@ -1,11 +1,22 @@
|
|||||||
use base "anacondatest";
|
use base "anacondatest";
|
||||||
use strict;
|
use strict;
|
||||||
|
use lockapi;
|
||||||
use testapi;
|
use testapi;
|
||||||
use utils;
|
use utils;
|
||||||
use anaconda;
|
use anaconda;
|
||||||
|
|
||||||
sub run {
|
sub run {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
|
if (get_var("PXEBOOT")) {
|
||||||
|
# PXE tests have DELAYED_START set, so VM is not running yet,
|
||||||
|
# because if we boot immediately PXE will time out waiting for
|
||||||
|
# DHCP before the support server is ready. So we wait here for
|
||||||
|
# support server to be ready, then go ahead and start the VM
|
||||||
|
mutex_lock "support_ready";
|
||||||
|
mutex_unlock "support_ready";
|
||||||
|
resume_vm;
|
||||||
|
}
|
||||||
|
|
||||||
# construct the kernel params. the trick here is to wind up with
|
# construct the kernel params. the trick here is to wind up with
|
||||||
# spaced params if GRUB or GRUBADD is set, and just spaces if not,
|
# spaced params if GRUB or GRUBADD is set, and just spaces if not,
|
||||||
# then check if we got all spaces. We wind up with a harmless
|
# then check if we got all spaces. We wind up with a harmless
|
||||||
@ -36,8 +47,12 @@ sub run {
|
|||||||
# set mutex wait if necessary
|
# set mutex wait if necessary
|
||||||
my $mutex = get_var("INSTALL_UNLOCK");
|
my $mutex = get_var("INSTALL_UNLOCK");
|
||||||
|
|
||||||
|
# we need a longer timeout for the PXE boot test
|
||||||
|
my $timeout = 30;
|
||||||
|
$timeout = 120 if (get_var("PXEBOOT"));
|
||||||
|
|
||||||
# call do_bootloader with postinstall=0, the params, and the mutex
|
# call do_bootloader with postinstall=0, the params, and the mutex
|
||||||
do_bootloader(postinstall=>0, params=>$params, mutex=>$mutex);
|
do_bootloader(postinstall=>0, params=>$params, mutex=>$mutex, timeout=>$timeout);
|
||||||
|
|
||||||
# Read variables for identification tests (see further).
|
# Read variables for identification tests (see further).
|
||||||
my $identification = get_var('IDENTIFICATION');
|
my $identification = get_var('IDENTIFICATION');
|
||||||
|
@ -1,16 +1,97 @@
|
|||||||
use base "installedtest";
|
use base "installedtest";
|
||||||
use strict;
|
use strict;
|
||||||
|
use anaconda;
|
||||||
use testapi;
|
use testapi;
|
||||||
use lockapi;
|
use lockapi;
|
||||||
use mmapi;
|
use mmapi;
|
||||||
use tapnet;
|
use tapnet;
|
||||||
use utils;
|
use utils;
|
||||||
|
|
||||||
|
sub _pxe_setup {
|
||||||
|
# set up PXE server (via dnsmasq). Not used for update tests.
|
||||||
|
# don't get hung up on slow mirrors when DNFing...
|
||||||
|
repos_mirrorlist;
|
||||||
|
# create necessary dirs
|
||||||
|
assert_script_run "mkdir -p /var/lib/tftpboot/fedora";
|
||||||
|
# basic tftp config
|
||||||
|
assert_script_run "printf 'enable-tftp\ntftp-root=/var/lib/tftpboot\ntftp-secure\n' >> /etc/dnsmasq.conf";
|
||||||
|
# pxe boot config
|
||||||
|
# we boot grub directly not shim on aarch64 as shim fails to boot
|
||||||
|
# with 'Synchronous Exception'
|
||||||
|
# https://bugzilla.redhat.com/show_bug.cgi?id=1592148
|
||||||
|
assert_script_run "printf 'dhcp-match=set:efi-x86_64,option:client-arch,7\ndhcp-match=set:efi-x86_64,option:client-arch,9\ndhcp-match=set:bios,option:client-arch,0\ndhcp-match=set:efi-aarch64,option:client-arch,11\ndhcp-match=set:ppc64,option:client-arch,12\ndhcp-match=set:ppc64,option:client-arch,13\ndhcp-boot=tag:efi-x86_64,\"shim.efi\"\ndhcp-boot=tag:bios,\"pxelinux.0\"\ndhcp-boot=tag:efi-aarch64,\"grubaa64.efi\"\ndhcp-boot=tag:ppc64,\"boot/grub2/powerpc-ieee1275/core.elf\"\n' >> /etc/dnsmasq.conf";
|
||||||
|
# install and configure bootloaders
|
||||||
|
my $ourversion = get_var("CURRREL");
|
||||||
|
my $testversion = get_var("RELEASE");
|
||||||
|
assert_script_run "mkdir -p /var/tmp/fedora";
|
||||||
|
my $arch = get_var("ARCH");
|
||||||
|
|
||||||
|
if ($arch eq 'x86_64') {
|
||||||
|
# x86_64: use syslinux for BIOS, grub2 with 'linuxefi' for UEFI
|
||||||
|
assert_script_run "mkdir -p /var/lib/tftpboot/pxelinux.cfg";
|
||||||
|
# install bootloader packages
|
||||||
|
assert_script_run "dnf -y install syslinux", 120;
|
||||||
|
assert_script_run "dnf -y --releasever=$ourversion --installroot=/var/tmp/fedora install shim-x64 grub2-efi-x64", 300;
|
||||||
|
# copy bootloader files to tftp root
|
||||||
|
assert_script_run "cp /usr/share/syslinux/{pxelinux.0,vesamenu.c32,ldlinux.c32,libcom32.c32,libutil.c32} /var/lib/tftpboot";
|
||||||
|
assert_script_run "cp /var/tmp/fedora/boot/efi/EFI/fedora/{shim.efi,grubx64.efi} /var/lib/tftpboot";
|
||||||
|
# bootloader configs
|
||||||
|
# BIOS
|
||||||
|
assert_script_run "printf 'default vesamenu.c32\nprompt 1\ntimeout 600\n\nlabel linux\n menu label ^Install Fedora 64-bit\n menu default\n kernel fedora/vmlinuz\n append initrd=fedora/initrd.img inst.repo=nfs:nfsvers=4:10.0.2.110:/repo ip=dhcp\nlabel local\n menu label Boot from ^local drive\n localboot 0xffff\n' >> /var/lib/tftpboot/pxelinux.cfg/default";
|
||||||
|
# UEFI
|
||||||
|
assert_script_run "printf 'function load_video {\n insmod efi_gop\n insmod efi_uga\n insmod ieee1275_fb\n insmod vbe\n insmod vga\n insmod video_bochs\n insmod video_cirrus\n}\n\nload_video\nset gfxpayload=keep\ninsmod gzio\n\nmenuentry \"Install Fedora 64-bit\" --class fedora --class gnu-linux --class gnu --class os {\n linuxefi fedora/vmlinuz ip=dhcp inst.repo=nfs:nfsvers=4:10.0.2.110:/repo\n initrdefi fedora/initrd.img\n}' >> /var/lib/tftpboot/grub.cfg";
|
||||||
|
# DEBUG DEBUG
|
||||||
|
upload_logs "/etc/dnsmasq.conf";
|
||||||
|
upload_logs "/var/lib/tftpboot/grub.cfg";
|
||||||
|
upload_logs "/var/lib/tftpboot/pxelinux.cfg/default";
|
||||||
|
}
|
||||||
|
|
||||||
|
elsif ($arch eq 'ppc64le') {
|
||||||
|
# ppc64le: use grub2 for OFW
|
||||||
|
# install bootloader tools package
|
||||||
|
assert_script_run "dnf -y install grub2-tools-extra", 180;
|
||||||
|
# install a network bootloader to tftp root
|
||||||
|
assert_script_run "grub2-mknetdir --net-directory=/var/lib/tftpboot";
|
||||||
|
# bootloader config
|
||||||
|
assert_script_run "printf 'set default=0\nset timeout=5\n\nmenuentry \"Install Fedora 64-bit\" --class fedora --class gnu-linux --class gnu --class os {\n linux fedora/vmlinuz ip=dhcp inst.repo=nfs:nfsvers=4:10.0.2.110:/repo\n initrd fedora/initrd.img\n}' >> /var/lib/tftpboot/boot/grub2/grub.cfg";
|
||||||
|
# DEBUG DEBUG
|
||||||
|
upload_logs "/etc/dnsmasq.conf";
|
||||||
|
upload_logs "/var/lib/tftpboot/boot/grub2/grub.cfg";
|
||||||
|
}
|
||||||
|
|
||||||
|
elsif ($arch eq 'aarch64') {
|
||||||
|
# aarch64: use grub2 with 'linux' for UEFI
|
||||||
|
# copy bootloader files to tftp root (we just use the system
|
||||||
|
# bootloader, no need to install packages)
|
||||||
|
assert_script_run "cp /boot/efi/EFI/fedora/{shim.efi,grubaa64.efi} /var/lib/tftpboot";
|
||||||
|
# bootloader config
|
||||||
|
assert_script_run "printf 'function load_video {\n insmod efi_gop\n insmod efi_uga\n insmod ieee1275_fb\n insmod vbe\n insmod vga\n insmod video_bochs\n insmod video_cirrus\n}\n\nload_video\nset gfxpayload=keep\ninsmod gzio\n\nmenuentry \"Install Fedora 64-bit\" --class fedora --class gnu-linux --class gnu --class os {\n linux fedora/vmlinuz ip=dhcp inst.repo=nfs:nfsvers=4:10.0.2.110:/repo\n initrd fedora/initrd.img\n}' >> /var/lib/tftpboot/grub.cfg";
|
||||||
|
# DEBUG DEBUG
|
||||||
|
upload_logs "/etc/dnsmasq.conf";
|
||||||
|
upload_logs "/var/lib/tftpboot/grub.cfg";
|
||||||
|
}
|
||||||
|
|
||||||
|
# download kernel and initramfs
|
||||||
|
my $location = get_var("LOCATION");
|
||||||
|
my $kernpath = "images/pxeboot";
|
||||||
|
# for some crazy reason these are in a different place for ppc64
|
||||||
|
$kernpath = "ppc/ppc64" if ($arch eq 'ppc64le');
|
||||||
|
assert_script_run "curl -o /var/lib/tftpboot/fedora/vmlinuz $location/Everything/${arch}/os/${kernpath}/vmlinuz";
|
||||||
|
assert_script_run "curl -o /var/lib/tftpboot/fedora/initrd.img $location/Everything/${arch}/os/${kernpath}/initrd.img";
|
||||||
|
# chown root
|
||||||
|
assert_script_run "chown -R dnsmasq /var/lib/tftpboot";
|
||||||
|
assert_script_run "restorecon -vr /var/lib/tftpboot";
|
||||||
|
# open firewall ports
|
||||||
|
assert_script_run "firewall-cmd --add-service=tftp";
|
||||||
|
}
|
||||||
|
|
||||||
sub run {
|
sub run {
|
||||||
my $self=shift;
|
my $self=shift;
|
||||||
## DNS / DHCP (dnsmasq)
|
## DNS / DHCP (dnsmasq)
|
||||||
# create config
|
# create config
|
||||||
assert_script_run "printf 'domain=domain.local\ndhcp-range=10.0.2.112,10.0.2.199\ndhcp-option=option:router,10.0.2.2' > /etc/dnsmasq.conf";
|
assert_script_run "printf 'domain=domain.local\ndhcp-range=10.0.2.112,10.0.2.199\ndhcp-option=option:router,10.0.2.2\n' > /etc/dnsmasq.conf";
|
||||||
|
# do PXE setup if this is not an update test
|
||||||
|
_pxe_setup() unless (get_var("ADVISORY_OR_TASK"));
|
||||||
# open firewall ports
|
# open firewall ports
|
||||||
assert_script_run "firewall-cmd --add-service=dhcp";
|
assert_script_run "firewall-cmd --add-service=dhcp";
|
||||||
assert_script_run "firewall-cmd --add-service=dns";
|
assert_script_run "firewall-cmd --add-service=dns";
|
||||||
@ -67,7 +148,8 @@ sub run {
|
|||||||
# report ready, wait for children
|
# report ready, wait for children
|
||||||
mutex_create('support_ready');
|
mutex_create('support_ready');
|
||||||
wait_for_children;
|
wait_for_children;
|
||||||
# TODO we should add systematic data capture to help investigation when children failed.
|
# upload logs in case of child failures
|
||||||
|
$self->post_fail_hook();
|
||||||
}
|
}
|
||||||
|
|
||||||
sub test_flags {
|
sub test_flags {
|
||||||
|
Loading…
Reference in New Issue
Block a user