diff --git a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu24.04.ppc64el.pkglist b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu24.04.ppc64el.pkglist index f8eaecec00..e5703b3989 100644 --- a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu24.04.ppc64el.pkglist +++ b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu24.04.ppc64el.pkglist @@ -18,3 +18,5 @@ gzip xz-utils cpio chrony +dracut +dracut-network diff --git a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu24.04.ppc64le.pkglist b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu24.04.ppc64le.pkglist index f8eaecec00..e5703b3989 100644 --- a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu24.04.ppc64le.pkglist +++ b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu24.04.ppc64le.pkglist @@ -18,3 +18,5 @@ gzip xz-utils cpio chrony +dracut +dracut-network diff --git a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu26.04.pkglist b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu26.04.pkglist index f78cfa88ba..0d88c859d7 100644 --- a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu26.04.pkglist +++ b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu26.04.pkglist @@ -15,3 +15,5 @@ gawk tar gzip xz-utils +dracut +dracut-network diff --git a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu26.04.ppc64el.pkglist b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu26.04.ppc64el.pkglist index f8eaecec00..e5703b3989 100644 --- a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu26.04.ppc64el.pkglist +++ b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu26.04.ppc64el.pkglist @@ -18,3 +18,5 @@ gzip xz-utils cpio chrony +dracut +dracut-network diff --git a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu26.04.x86_64.pkglist b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu26.04.x86_64.pkglist index ef2f26fe10..a5554fe3f9 100644 --- a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu26.04.x86_64.pkglist +++ b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu26.04.x86_64.pkglist @@ -16,3 +16,5 @@ gzip xz-utils cpio chrony +dracut +dracut-network diff --git a/xCAT-test/unit/profile_customization.t b/xCAT-test/unit/profile_customization.t index ee85c73ea4..5513b72ea2 100644 --- a/xCAT-test/unit/profile_customization.t +++ b/xCAT-test/unit/profile_customization.t @@ -70,8 +70,10 @@ for my $release (qw(24.04 26.04)) { my @expected = qw(bash nfs-common openssl isc-dhcp-client libc-bin linux-image-generic openssh-server openssh-client wget rsync busybox-static gawk bind9-dnsutils tar gzip xz-utils cpio chrony); - push @expected, qw(util-linux-extra iproute2 dracut dracut-network) - if $release eq '24.04'; + push @expected, qw(util-linux-extra iproute2) if $release eq '24.04'; + # genimage enters dracut mode only when the rootimg carries dracut. Every release + # needs it, because the legacy /init it falls back to is IPv4-only. + push @expected, qw(dracut dracut-network); push @cases, ['netboot', 'ubuntu', 'compute', "ubuntu$release", 'riscv64', 'pkglist', "compute.ubuntu$release.riscv64.pkglist", \@expected]; } diff --git a/xCAT-test/unit/ubuntu_netboot_dracut_pkglists.t b/xCAT-test/unit/ubuntu_netboot_dracut_pkglists.t new file mode 100644 index 0000000000..7405ccf344 --- /dev/null +++ b/xCAT-test/unit/ubuntu_netboot_dracut_pkglists.t @@ -0,0 +1,56 @@ +#!/usr/bin/env perl +use strict; +use warnings; + +use FindBin; +use Test::More; + +# genimage enters dracut mode only when the rootimg carries dracut +# (xCAT-server/share/xcat/netboot/ubuntu/genimage). A netboot package list with no +# dracut falls back to the legacy /init, which waits for an "inet addr" line and cuts +# XCATSERVER at the first colon. Both are IPv4-only, so an IPv6-only diskless node +# never boots. The package list is the artifact that decides this. +# +# 24.04 x86_64 is the reference: it already carries the entries and boots IPv6-only. + +use lib "$FindBin::Bin/../lib"; +use XCAT::Test::File qw(repo_path); +use File::Slurper qw(read_lines); + +my $netboot = 'xCAT-server/share/xcat/netboot/ubuntu'; + +my @lists = ( + "compute.ubuntu24.04.x86_64.pkglist", # the working reference + "compute.ubuntu24.04.ppc64el.pkglist", + "compute.ubuntu24.04.ppc64le.pkglist", + "compute.ubuntu26.04.pkglist", + "compute.ubuntu26.04.ppc64el.pkglist", + "compute.ubuntu26.04.ppc64le.pkglist", + "compute.ubuntu26.04.riscv64.pkglist", + "compute.ubuntu26.04.x86_64.pkglist", +); + +sub packages { + my ($name) = @_; + my $path = repo_path("$netboot/$name"); + return unless -r $path; + my @packages = grep { length && !/^#/ } + map { my $line = $_; $line =~ s/\s+//g; $line } read_lines($path); + return \@packages; +} + +foreach my $name (@lists) { + my $list = packages($name); + ok($list, "$name is readable"); + + SKIP: { + skip "no $name to inspect", 2 unless $list; + + ok(scalar(grep { $_ eq 'dracut' } @{$list}), + "$name installs dracut, so genimage enters dracut mode"); + ok(scalar(grep { $_ eq 'dracut-network' } @{$list}), + "$name installs dracut-network, which brings the IPv6 boot modules"); + } +} + +done_testing();