From 10d1d92d79ed9e4b044584640b969919e99c7888 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Ferr=C3=A3o?= <2031761+viniciusferrao@users.noreply.github.com> Date: Thu, 27 Aug 2026 16:25:58 -0300 Subject: [PATCH] fix(template): honour installnic when the kickstart names the install device noderes.installnic names the adapter that deploys the operating system. The kickstart network line ignored it and named the adapter from mac.mac alone, so a node that sets installnic got a kernel command line that obeys installnic and a kickstart that configures a different adapter. On a node with more than one adapter the installer then brings up the wrong one and cannot reach the repository. Name the device from the shared resolution, which gives the interface name when installnic or primarynic names one, and the address otherwise. A node that sets neither attribute keeps the address it has today. The unique local address still comes from the hardware address, because autoulaaddress builds the address from it. --- xCAT-server/lib/perl/xCAT/Template.pm | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/xCAT-server/lib/perl/xCAT/Template.pm b/xCAT-server/lib/perl/xCAT/Template.pm index e2d077e4c..8eba50a8f 100644 --- a/xCAT-server/lib/perl/xCAT/Template.pm +++ b/xCAT-server/lib/perl/xCAT/Template.pm @@ -1052,13 +1052,23 @@ sub kickstartnetwork { unless ($mactab) { $tmplerr = "mac table should always exist prior to template processing when doing autoula"; return; } my $ent = $mactab->getNodeAttribs($node, ['mac'], prefetchcache => 1); unless ($ent and $ent->{mac}) { $tmplerr = "missing mac data for $node"; return; } - my $suffix = xCAT::Utils->parseMacTabEntry($ent->{mac}, $node); - $suffix = lc($suffix); + my ($installnic, $primarynic); + my $nrtab = xCAT::Table->new('noderes', -create => 0); + if ($nrtab) { + my $nrent = $nrtab->getNodeAttribs($node, [ 'installnic', 'primarynic' ], prefetchcache => 1); + if ($nrent) { + $installnic = $nrent->{installnic}; + $primarynic = $nrent->{primarynic}; + } + } + my $params = install_device_params($installnic, $primarynic, $ent->{mac}, $node); + my $macaddr = defined($params->{mac}) ? lc($params->{mac}) : ''; + my $suffix = defined($params->{nicname}) ? $params->{nicname} : $macaddr; if ($::XCATSITEVALS{managedaddressmode} eq "autoula") { unless ($hoststab) { $hoststab = xCAT::Table->new('hosts', -create => 1); } $line .= "static --device=$suffix --noipv4 --ipv6="; - my $ulaaddr = autoulaaddress($suffix); + my $ulaaddr = autoulaaddress($macaddr); $hoststab->setNodeAttribs($node, { ip => $ulaaddr }); $line .= $ulaaddr; } elsif ($::XCATSITEVALS{managedaddressmode} =~ /static/) {