2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-09-08 20:50:44 +00:00

fix(genesis): harden s390x boot handoff

This commit is contained in:
Vinícius Ferrão
2026-09-04 14:42:35 -03:00
parent 5203c17a87
commit f549f46b51
3 changed files with 57 additions and 15 deletions
+23 -7
View File
@@ -114,8 +114,9 @@ sub kea_s390x_network_classes {
my $safe_network = $network_id;
$safe_network =~ s{[^[:alnum:]_.-]}{_}gxms;
return [
{
my @classes;
if ( $opts{qemu_config_present} ) {
push @classes, {
name => "xcat-s390x-qemu-$safe_network",
test => 'option[93].hex == 0x001f',
additional_only => 1,
@@ -131,8 +132,17 @@ sub kea_s390x_network_classes {
'always-send' => 1,
},
],
},
];
};
}
if ( $opts{dpm_config_present} ) {
push @classes, {
name => "xcat-s390x-dpm-$safe_network",
test => 'option[93].hex == 0x0020',
additional_only => 1,
'boot-file-name' => "pxelinux.cfg/s390x/$network_id.dpm",
};
}
return \@classes;
}
sub ensure_isc_path_prefix_definition {
@@ -182,9 +192,15 @@ sub isc_client_architecture_lines {
" } else if option client-architecture = 00:1c { #riscv64 uefi http boot\n ",
" option vendor-class-identifier \"HTTPClient\";\n",
" filename \"http://$tftp$portsuffix/tftpboot/boot/grub2/grub2.riscv64\";\n",
" } else if option client-architecture = 00:1f { #QEMU s390x\n ",
" option path-prefix = \"pxelinux.cfg/s390x/\";\n",
" option conf-file = \"${net}_${maskbits}\";\n",
($opts{s390x_qemu_config_present} ? (
" } else if option client-architecture = 00:1f { #QEMU s390x\n ",
" option path-prefix = \"pxelinux.cfg/s390x/\";\n",
" option conf-file = \"${net}_${maskbits}\";\n",
) : ()),
($opts{s390x_dpm_config_present} ? (
" } else if option client-architecture = 00:20 { #IBM Z DPM\n ",
" filename \"pxelinux.cfg/s390x/${net}_${maskbits}.dpm\";\n",
) : ()),
" } else if option client-architecture = 00:0e { #OPAL-v3\n ",
" option conf-file = \"http://$tftp$portsuffix/tftpboot/pxelinux.cfg/p/${net}_${maskbits}\";\n",
" } else if substring (option vendor-class-identifier,0,11) = \"onie_vendor\" { #for onie on cumulus switch\n",
+8 -2
View File
@@ -3368,8 +3368,10 @@ sub kea_subnet4_intent
};
push @client_classes, @{
xCAT::DHCP::BootPolicy->kea_s390x_network_classes(
net => $net,
prefix => $prefix,
net => $net,
prefix => $prefix,
qemu_config_present => -f "$tftpdir/pxelinux.cfg/s390x/${net}_${prefix}",
dpm_config_present => -f "$tftpdir/pxelinux.cfg/s390x/${net}_${prefix}.dpm",
)
};
if (@client_classes) {
@@ -4534,6 +4536,10 @@ sub addnet
tftpdir => $tftpdir,
net => $net,
prefix => $maskbits,
s390x_qemu_config_present =>
-f "$tftpdir/pxelinux.cfg/s390x/${net}_${maskbits}",
s390x_dpm_config_present =>
-f "$tftpdir/pxelinux.cfg/s390x/${net}_${maskbits}.dpm",
) };
if ($range) {
+26 -6
View File
@@ -302,10 +302,14 @@ sub _remove_openembedded_genesis {
"$directory/genesis.exact-arch.$arch",
);
if ($arch eq 's390x') {
foreach my $path (glob "$tftpdir/pxelinux.cfg/s390x/*") {
if (_is_generated_s390x_config($path)) {
push @artifacts, $path;
my $config_directory = "$tftpdir/pxelinux.cfg/s390x";
if (opendir(my $config_stream, $config_directory)) {
foreach my $name (readdir $config_stream) {
next if $name eq '.' || $name eq '..';
my $path = "$config_directory/$name";
push @artifacts, $path if _is_generated_s390x_config($path);
}
closedir $config_stream;
}
}
my $removed = 0;
@@ -739,6 +743,7 @@ sub process_request {
chmod(0755, "$tftpdir/boot/grub2");
} elsif ($arch eq 's390x') {
mkpath "$tftpdir/pxelinux.cfg/s390x";
chmod 0755, "$tftpdir/pxelinux.cfg";
chmod 0755, "$tftpdir/pxelinux.cfg/s390x";
}
my $dopxe = 0;
@@ -752,9 +757,11 @@ sub process_request {
if ($arch =~ /ppc/ and -r "$tftpdir/pxelinux.cfg/p/$net") {
unlink("$tftpdir/pxelinux.cfg/p/$net");
} elsif ($arch eq 's390x') {
my $path = "$tftpdir/pxelinux.cfg/s390x/$net";
if (_is_generated_s390x_config($path)) {
unlink $path;
foreach my $path (
"$tftpdir/pxelinux.cfg/s390x/$net",
"$tftpdir/pxelinux.cfg/s390x/$net.dpm",
) {
unlink $path if _is_generated_s390x_config($path);
}
}
next;
@@ -919,6 +926,19 @@ sub _write_s390x_discovery_config {
my $error = _write_s390x_config($qemu_path, $qemu_config);
return (undef, $error) if $error;
my $dpm_path = "$qemu_path.dpm";
my $dpm_config = "# pxelinux.cfg xCAT Genesis s390x\n"
. "DEFAULT xCAT\n"
. "label xCAT\n"
. " kernel=xcat/genesis.kernel.s390x\n"
. " initrd=$initrd\n"
. " append=$cmdline\n";
$error = _write_s390x_config($dpm_path, $dpm_config);
if ($error) {
unlink $qemu_path;
return (undef, $error);
}
return ($qemu_path, undef);
}