From 52895bb7a88210219492fc250c1988f9df4404ad Mon Sep 17 00:00:00 2001 From: Trevor Cooper Date: Sun, 7 Apr 2024 13:36:02 -0700 Subject: [PATCH 1/7] define and canonicalize correct format of LOCATION run variable --- VARIABLES.md | 2 +- lib/anaconda.pm | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/VARIABLES.md b/VARIABLES.md index d036b977..7e34fc5f 100644 --- a/VARIABLES.md +++ b/VARIABLES.md @@ -107,6 +107,6 @@ These variables should be set when tests are scheduled (when running `isos post` | `PREVREL` | the previous stable Rocky release at the time of the test run | | `UP1REL` | the source release for "1-release" upgrade tests (usually but not always same as `CURRREL`) | | `UP2REL` | the source release for "2-release" upgrade tests (currently always same as `PREVREL`) | -| `LOCATION` | Rocky doesn't replicate compose process used by upstream distribution. `LOCATION` has three general use cases: substitution value for `REPOSITORY_VARIATION` or `REPOSITORY_GRAPHICAL` in `templates.fif.json`, within `utils.pm` in `_repo_setup_compose` which is not valid for Rocky and within `support_server.pm` in `_pxe_setup` to pull the kernel and initrd used for PXE installs. | +| `LOCATION` | Rocky doesn't replicate compose process used by upstream distribution. `LOCATION` has three general use cases: substitution value for `REPOSITORY_VARIATION` or `REPOSITORY_GRAPHICAL` in `templates.fif.json`, within `utils.pm` in `_repo_setup_compose` which is not valid for Rocky and within `support_server.pm` in `_pxe_setup` to pull the kernel and initrd used for PXE installs. Required value is repository URL prefix, eg. `https://download.rockylinux.org/pub/rocky/8/`. | | `DNF_CONTENTDIR` | the value to change `/etc/dnf/vars/contentdir` to (eg. `stg/rocky`) allowing repository reconfiguration to point at staging (usually but not always used with `DNF_RELEASEVER`) | | `DNF_RELEASEVER` | the value to change `/etc/dnf/vars/releasever` to (eg. `8.8-Beta`) allowing repository reconfiguration to point at a specific release (usually but not always used with `DNF_CONTENTDIR`) | diff --git a/lib/anaconda.pm b/lib/anaconda.pm index 59d509a7..f73dc652 100644 --- a/lib/anaconda.pm +++ b/lib/anaconda.pm @@ -366,9 +366,9 @@ sub get_full_repo { # repo URL with flavor and arch, leave hd & NFS ones alone # (as for those tests we just use a mounted ISO and URL is complete) if ($repourl !~ m/^(nfs|hd:)/) { - # Everything variant doesn't exist for modular composes atm, - # only Server - $repourl .= "/" . get_var("ARCH") . "/os"; + # Rocky Linux default repo is BaseOS. This subdirectory + # should be added to ${LOCATION}. + $repourl .= "/BaseOS/" . get_var("ARCH") . "/os"; } return $repourl; } From bc574db086866eff5405fb32f15b9c976e86e54f Mon Sep 17 00:00:00 2001 From: Trevor Cooper Date: Sun, 7 Apr 2024 14:19:12 -0700 Subject: [PATCH 2/7] use baseurl and support DNF_CONTENTDIR in _pxe_setup --- tests/_support_server.pm | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/tests/_support_server.pm b/tests/_support_server.pm index 8d732220..f1272353 100644 --- a/tests/_support_server.pm +++ b/tests/_support_server.pm @@ -25,6 +25,7 @@ sub _pxe_setup { 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 $contentdir = get_var("DNF_CONTENTDIR"); my $testversion = get_var("RELEASE"); assert_script_run "mkdir -p /var/tmp/rocky"; my $arch = get_var("ARCH"); @@ -41,7 +42,26 @@ sub _pxe_setup { assert_script_run "rpm --root=/var/tmp/rocky --rebuilddb", 60; assert_script_run "cd /var/tmp; dnf download rocky-release rocky-repos rocky-gpg-keys", 60; assert_script_run "rpm --root=/var/tmp/rocky --nodeps -i /var/tmp/*.rpm", 60; - #assert_script_run "sed -i /var/tmp/rocky/etc/yum.repos.d/Rocky-*.repo -e 's/repo=/repo=rocky-/g'", 60; + + # Rocky Linux repos in /var/tmp/rocky point at mirrorlist and should be + # pointed at baseurl to support repositories in the staging if used for + # Beta or Lookahead builds. + if (get_version_major() < 9) { + assert_script_run 'sed -i -e "s/^mirrorlist/#mirrorlist/g;s,^#\(baseurl=http[s]*://\),\1,g" ' . '/var/tmp/rocky/etc/yum.repos.d/Rocky-BaseOS.repo'; + assert_script_run 'sed -i -e "s/^mirrorlist/#mirrorlist/g;s,^#\(baseurl=http[s]*://\),\1,g" ' . '/var/tmp/rocky/etc/yum.repos.d/Rocky-AppStream.repo'; + assert_script_run 'sed -i -e "s/^mirrorlist/#mirrorlist/g;s,^#\(baseurl=http[s]*://\),\1,g" ' . '/var/tmp/rocky/etc/yum.repos.d/Rocky-Extras.repo'; + assert_script_run 'sed -i -e "s/^mirrorlist/#mirrorlist/g;s,^#\(baseurl=http[s]*://\),\1,g" ' . '/var/tmp/rocky/etc/yum.repos.d/Rocky-Devel.repo'; + } else { + script_run 'sed -i -e "s/^mirrorlist/#mirrorlist/g;s/^#baseurl/baseurl/g" ' . $mount . '/var/tmp/rocky/etc/yum.repos.d/rocky.repo'; + script_run 'sed -i -e "s/^mirrorlist/#mirrorlist/g;s/^#baseurl/baseurl/g" ' . $mount . '/var/tmp/rocky/etc/yum.repos.d/rocky-addons.repo'; + script_run 'sed -i -e "s/^mirrorlist/#mirrorlist/g;s/^#baseurl/baseurl/g" ' . $mount . '/var/tmp/rocky/etc/yum.repos.d/rocky-devel.repo'; + script_run 'sed -i -e "s/^mirrorlist/#mirrorlist/g;s/^#baseurl/baseurl/g" ' . $mount . '/var/tmp/rocky/etc/yum.repos.d/rocky-extras.repo'; + } + # If we're pointing at Staging via alternate DNF_CONTENTDIR then modify dnf vars in /var/tmp/rocky + if ($contentdir) { + assert_script_run 'printf "%s\n" ' . $contentdir . ' > ' . '/var/tmp/rocky/etc/dnf/vars/contentdir'; + } + assert_script_run "dnf -y --releasever=$ourversion --refresh --installroot=/var/tmp/rocky install shim-x64 grub2-efi-x64", 1800; # copy bootloader files to tftp root From 604da547cd3462d5f2722cca008e2514f8153ea4 Mon Sep 17 00:00:00 2001 From: Trevor Cooper Date: Sun, 7 Apr 2024 14:25:14 -0700 Subject: [PATCH 3/7] remove refs to undefined variable --- tests/_support_server.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/_support_server.pm b/tests/_support_server.pm index f1272353..0533692d 100644 --- a/tests/_support_server.pm +++ b/tests/_support_server.pm @@ -52,10 +52,10 @@ sub _pxe_setup { assert_script_run 'sed -i -e "s/^mirrorlist/#mirrorlist/g;s,^#\(baseurl=http[s]*://\),\1,g" ' . '/var/tmp/rocky/etc/yum.repos.d/Rocky-Extras.repo'; assert_script_run 'sed -i -e "s/^mirrorlist/#mirrorlist/g;s,^#\(baseurl=http[s]*://\),\1,g" ' . '/var/tmp/rocky/etc/yum.repos.d/Rocky-Devel.repo'; } else { - script_run 'sed -i -e "s/^mirrorlist/#mirrorlist/g;s/^#baseurl/baseurl/g" ' . $mount . '/var/tmp/rocky/etc/yum.repos.d/rocky.repo'; - script_run 'sed -i -e "s/^mirrorlist/#mirrorlist/g;s/^#baseurl/baseurl/g" ' . $mount . '/var/tmp/rocky/etc/yum.repos.d/rocky-addons.repo'; - script_run 'sed -i -e "s/^mirrorlist/#mirrorlist/g;s/^#baseurl/baseurl/g" ' . $mount . '/var/tmp/rocky/etc/yum.repos.d/rocky-devel.repo'; - script_run 'sed -i -e "s/^mirrorlist/#mirrorlist/g;s/^#baseurl/baseurl/g" ' . $mount . '/var/tmp/rocky/etc/yum.repos.d/rocky-extras.repo'; + script_run 'sed -i -e "s/^mirrorlist/#mirrorlist/g;s/^#baseurl/baseurl/g" ' . '/var/tmp/rocky/etc/yum.repos.d/rocky.repo'; + script_run 'sed -i -e "s/^mirrorlist/#mirrorlist/g;s/^#baseurl/baseurl/g" ' . '/var/tmp/rocky/etc/yum.repos.d/rocky-addons.repo'; + script_run 'sed -i -e "s/^mirrorlist/#mirrorlist/g;s/^#baseurl/baseurl/g" ' . '/var/tmp/rocky/etc/yum.repos.d/rocky-devel.repo'; + script_run 'sed -i -e "s/^mirrorlist/#mirrorlist/g;s/^#baseurl/baseurl/g" ' . '/var/tmp/rocky/etc/yum.repos.d/rocky-extras.repo'; } # If we're pointing at Staging via alternate DNF_CONTENTDIR then modify dnf vars in /var/tmp/rocky if ($contentdir) { From 803a83d72967d8873657af8c9c881fb3fd54c0be Mon Sep 17 00:00:00 2001 From: Trevor Cooper Date: Sun, 7 Apr 2024 16:02:01 -0700 Subject: [PATCH 4/7] remove linefeeds that break PXE config --- tests/_support_server.pm | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/tests/_support_server.pm b/tests/_support_server.pm index 0533692d..deaff62d 100644 --- a/tests/_support_server.pm +++ b/tests/_support_server.pm @@ -69,12 +69,9 @@ sub _pxe_setup { assert_script_run "cp /var/tmp/rocky/boot/efi/EFI/rocky/{shimx64.efi,shimx64-rocky.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 Rocky Linux 64-bit\n menu default\n kernel rocky/vmlinuz\n append initr -d=rocky/initrd.img inst.ks=file:///ks.cfg ip=dhcp\nlabel local\n menu label Boot from ^local drive\n localboot 0xffff\n' >> /var/lib/tftpboot/pxelinux.cfg/default"; + assert_script_run "printf 'default vesamenu.c32\nprompt 1\ntimeout 600\n\nlabel linux\n menu label ^Install Rocky Linux 64-bit\n menu default\n kernel rocky/vmlinuz\n append initrd=rocky/initrd.img inst.ks=file:///ks.cfg 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 Rocky Linux 64-bit\" --class rocky --class gnu-linux --class gnu --class os {\n linuxefi rocky/vmlinuz ip=dhcp inst.ks= -file:///ks.cfg\n initrdefi rocky/initrd.img\n}' >> /var/lib/tftpboot/grub.cfg"; + 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 Rocky Linux 64-bit\" --class rocky --class gnu-linux --class gnu --class os {\n linuxefi rocky/vmlinuz ip=dhcp inst.ks=file:///ks.cfg\n initrdefi rocky/initrd.img\n}' >> /var/lib/tftpboot/grub.cfg"; # DEBUG DEBUG upload_logs "/etc/dnsmasq.conf"; upload_logs "/var/lib/tftpboot/grub.cfg"; From e9f102e4d41ad4d96a6b275f0ff76376e01f5d0c Mon Sep 17 00:00:00 2001 From: Trevor Cooper Date: Sun, 7 Apr 2024 17:36:06 -0700 Subject: [PATCH 5/7] add support for kickstart template with replaceable DNF_* run vars --- tests/_support_server.pm | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/tests/_support_server.pm b/tests/_support_server.pm index deaff62d..3acc3091 100644 --- a/tests/_support_server.pm +++ b/tests/_support_server.pm @@ -126,6 +126,7 @@ sub _pxe_setup { sub run { my $self = shift; + my $contentdir = get_var("DNF_CONTENTDIR"); # disable systemd-resolved, it conflicts with dnsmasq unless (script_run "systemctl is-active systemd-resolved.service") { script_run "systemctl stop systemd-resolved.service"; @@ -165,8 +166,20 @@ sub run { # create the file share assert_script_run "mkdir -p /export"; - # get the kickstart - assert_script_run "curl -o /export/root-user-crypted-net.ks https://git.rockylinux.org/tcooper/kickstarts/-/raw/main/root-user-crypted-net.ks"; + # get the kickstart or kickstart template and replace content + if ($contentdir) { + my $releasever = get_var("DNF_RELEASEVAR"); + assert_script_run "curl -o /export/root-user-crypted-net.ks https://git.rockylinux.org/tcooper/kickstarts/-/raw/main/root-user-crypted-net-template.ks"; + # Tweak the kickstart template + if ($releasever) { + assert_script_run "sed -e 's,DNF_CONTENTDIR," . $contentdir . ",g;s,DNF_RELEASEVER," . $releasever . ",g' ks.cfg"; + } else { + my $version = get_var("VERSION"); + assert_script_run "sed -e 's,DNF_CONTENTDIR," . $contentdir . ",g;s,DNF_RELEASEVER," . $version . ",g' ks.cfg"; + } + } else { + assert_script_run "curl -o /export/root-user-crypted-net.ks https://git.rockylinux.org/tcooper/kickstarts/-/raw/main/root-user-crypted-net.ks"; + } # for update tests, set up the update repository and export it if (get_var("ADVISORY_OR_TASK")) { assert_script_run "echo '/opt/update_repo 172.16.2.0/24(ro)' >> /etc/exports"; From 62c35a7d7ca830249d6a2d128677d6a602e7d350 Mon Sep 17 00:00:00 2001 From: Trevor Cooper Date: Mon, 8 Apr 2024 09:08:33 -0700 Subject: [PATCH 6/7] correct nfs mount option is nfsvers --- tests/_support_server.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/_support_server.pm b/tests/_support_server.pm index 3acc3091..ecb8b4cc 100644 --- a/tests/_support_server.pm +++ b/tests/_support_server.pm @@ -114,7 +114,7 @@ sub _pxe_setup { # https://fedoraproject.org/wiki/QA:Testcase_Kickstart_File_Path_Ks_Cfg assert_script_run "curl -o ks.cfg https://git.rockylinux.org/tcooper/kickstarts/-/raw/main/root-user-crypted-net.ks"; # tweak the repo config in it - assert_script_run "sed -i -e 's,^url.*,nfs --server=nfs://172.16.2.110 --dir=/repo --opts=nfsver=4,g' ks.cfg"; + assert_script_run "sed -i -e 's,^url.*,nfs --server=nfs://172.16.2.110 --dir=/repo --opts=nfsvers=4,g' ks.cfg"; # embed it assert_script_run "echo ks.cfg | cpio -c -o >> /var/lib/tftpboot/rocky/initrd.img"; # chown root From 3022c73f51ed40704242a1ecaf0cbc39bfeeb356 Mon Sep 17 00:00:00 2001 From: Trevor Cooper Date: Mon, 8 Apr 2024 21:41:31 -0700 Subject: [PATCH 7/7] add nfsv3 firewall config and use nfsv3 in ks.cfg --- tests/_support_server.pm | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/_support_server.pm b/tests/_support_server.pm index ecb8b4cc..80b1d395 100644 --- a/tests/_support_server.pm +++ b/tests/_support_server.pm @@ -114,7 +114,7 @@ sub _pxe_setup { # https://fedoraproject.org/wiki/QA:Testcase_Kickstart_File_Path_Ks_Cfg assert_script_run "curl -o ks.cfg https://git.rockylinux.org/tcooper/kickstarts/-/raw/main/root-user-crypted-net.ks"; # tweak the repo config in it - assert_script_run "sed -i -e 's,^url.*,nfs --server=nfs://172.16.2.110 --dir=/repo --opts=nfsvers=4,g' ks.cfg"; + assert_script_run "sed -i -e 's,^url.*,nfs --server=nfs://172.16.2.110 --dir=/repo,g' ks.cfg"; # embed it assert_script_run "echo ks.cfg | cpio -c -o >> /var/lib/tftpboot/rocky/initrd.img"; # chown root @@ -206,8 +206,14 @@ sub run { assert_script_run "printf '/export 172.16.2.0/24(ro)\n/repo 172.16.2.0/24(ro)\n/iso 172.16.2.0/24(ro)' > /etc/exports"; } - # open firewall port - assert_script_run "firewall-cmd --add-service=nfs"; + # configure nfsv3 ports + assert_script_run "printf '[lockd]\nport=5555\n\n[statd]\nport=6666\n' > /etc/nfs.conf"; + + # configure firewall + assert_script_run "firewall-cmd --add-service={nfs,rpc-bind,mountd}"; + assert_script_run "firewall-cmd --add-port={5555/tcp,5555/udp,6666/tcp,6666/udp}"; + assert_script_run "firewall-cmd --reload"; + # start the server assert_script_run "systemctl restart nfs-server.service"; assert_script_run "systemctl is-active nfs-server.service";