From a8c6bd2a4a6de8bd85677ba5dc20c433756da518 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Ferr=C3=A3o?= <2031761+viniciusferrao@users.noreply.github.com> Date: Fri, 4 Sep 2026 17:15:23 -0300 Subject: [PATCH] fix(genesis): harden s390x configurations --- xCAT-server/lib/xcat/plugins/mknb.pm | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/mknb.pm b/xCAT-server/lib/xcat/plugins/mknb.pm index 9a6c7fbcd..f00df75bb 100644 --- a/xCAT-server/lib/xcat/plugins/mknb.pm +++ b/xCAT-server/lib/xcat/plugins/mknb.pm @@ -757,13 +757,17 @@ sub process_request { my $nicip = $normnets->{$net}; my $xcatd_address = defined($xcatdnormnets->{$net}) ? $xcatdnormnets->{$net} : $nicip; $net =~ s/\//_/; - if (defined($nobootnicips{$nicip})) { + if (defined($nobootnicips{$nicip}) + || ($arch eq 's390x' && defined($nobootnicips{$xcatd_address}))) { 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; + if (!unlink($path)) { + $callback->({ error => ["Unable to remove s390x Genesis configuration: $path: $OS_ERROR"], errorcode => [1] }); + return; + } } } next; @@ -936,7 +940,7 @@ sub _write_s390x_discovery_config { sub _write_s390x_config { my ($path, $contents) = @_; - if (-f $path && !_is_generated_s390x_config($path)) { + if ((-e $path || -l $path) && !_is_generated_s390x_config($path)) { return "Refusing to replace unmanaged s390x configuration: $path"; } my $config;