From a701dfc2063982a1cfd26fcac614e87155b25bb6 Mon Sep 17 00:00:00 2001 From: Daniel Hilst <392820+dhilst@users.noreply.github.com> Date: Wed, 28 Oct 2026 10:21:32 -0300 Subject: [PATCH] fix(sles): an IPv6 install server is not bracketed in the install URLs sles.pm built its install URLs as "$server:$port". An IPv6 address contains colons, so a node was told to install from "http://2001:db8:156::1:80/install/leap15.6/x86_64/1" and could not reach the repository. The same join was in the statelite and stateless imgurl=. The XCAT= argument beside them was already bracketed. rootimg_url() and autoyast_boot_args() now build those URLs through xCAT::NetworkUtils::uri_authority(), which brackets an IPv6 address and passes a name or a !myipfn! placeholder through unchanged. uri_authority is the former xcatd_cmdline_address, renamed because three URL sites now share it; xcatd_cmdline_address stays as a wrapper for its own callers. xCAT-test/unit/sles_install_url_ipv6.t fails its four IPv6 assertions when the colon join is restored. Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com> --- perl-xCAT/xCAT/NetworkUtils.pm | 25 ++++++++++++--- xCAT-server/lib/xcat/plugins/sles.pm | 48 ++++++++++++++++++++++------ 2 files changed, 59 insertions(+), 14 deletions(-) diff --git a/perl-xCAT/xCAT/NetworkUtils.pm b/perl-xCAT/xCAT/NetworkUtils.pm index 1232d2853d..c734f141be 100644 --- a/perl-xCAT/xCAT/NetworkUtils.pm +++ b/perl-xCAT/xCAT/NetworkUtils.pm @@ -4023,13 +4023,13 @@ sub send_tcp_msg { #----------------------------------------------------------------------------- -=head3 xcatd_cmdline_address +=head3 uri_authority - Format a management node address and port for the xcatd= kernel argument. + Format an address and port as a URI authority, for a kernel argument or a URL. Arguments: - $address - the management node address, IPv4 or IPv6 - $port - the xcatd port + $address - an address, IPv4 or IPv6 + $port - the port Returns: "
:", with the address bracketed when it is IPv6. @@ -4039,7 +4039,7 @@ sub send_tcp_msg { =cut #----------------------------------------------------------------------------- -sub xcatd_cmdline_address { +sub uri_authority { my ($address, $port) = @_; return unless defined($address) && length($address); @@ -4047,4 +4047,19 @@ sub xcatd_cmdline_address { return "$address:$port"; } +#----------------------------------------------------------------------------- + +=head3 xcatd_cmdline_address + + The authority of the xcatd= kernel argument. See uri_authority. + +=cut + +#----------------------------------------------------------------------------- +sub xcatd_cmdline_address { + my ($address, $port) = @_; + + return uri_authority($address, $port); +} + 1; diff --git a/xCAT-server/lib/xcat/plugins/sles.pm b/xCAT-server/lib/xcat/plugins/sles.pm index ba51533831..e8011211c3 100644 --- a/xCAT-server/lib/xcat/plugins/sles.pm +++ b/xCAT-server/lib/xcat/plugins/sles.pm @@ -26,6 +26,42 @@ use File::Copy; use File::Temp qw/mkdtemp/; my $httpmethod = "http"; my $httpport = "80"; + +#------------------------------------------------------- + +=head3 rootimg_url + + Descriptions: The imgurl= value a statelite or stateless node downloads its root image from. + Arguments: the method, the image server, the port, the image directory, the image file + Returns: the URL, with an IPv6 server bracketed +=cut + +#------------------------------------------------------- +sub rootimg_url +{ + my ($httpmethod, $imgsrv, $httpport, $rootimgdir, $image) = @_; + my $authority = xCAT::NetworkUtils::uri_authority($imgsrv, $httpport); + return "$httpmethod://$authority/$rootimgdir/$image"; +} + +#------------------------------------------------------- + +=head3 autoyast_boot_args + + Descriptions: The autoyast= and install= arguments of a diskful SLES or Leap install. + Arguments: the method, the install server, the port, the package directory prefix, the node + Returns: both arguments, with an IPv6 server bracketed +=cut + +#------------------------------------------------------- +sub autoyast_boot_args +{ + my ($httpmethod, $netserver, $httpport, $httpprefix, $node) = @_; + my $authority = xCAT::NetworkUtils::uri_authority($netserver, $httpport); + return "autoyast=$httpmethod://$authority/install/autoinst/$node" + . " install=$httpmethod://$authority$httpprefix/1"; +} + my $useflowcontrol = "0"; use File::Find; use File::Basename; @@ -521,7 +557,7 @@ sub mknetboot $kcmdline = "NFSROOT=$nfssrv:$nfsdir STATEMNT="; } } else { - $kcmdline = "imgurl=$httpmethod://$imgsrv:$httpport/$rootimgdir/rootimg-statelite.gz STATEMNT="; + $kcmdline = "imgurl=" . rootimg_url($httpmethod, $imgsrv, $httpport, $rootimgdir, "rootimg-statelite.gz") . " STATEMNT="; $kcmdline = $checksum_arg . $kcmdline; } @@ -575,7 +611,7 @@ sub mknetboot else { $kcmdline = - "imgurl=$httpmethod://$imgsrv:$httpport/$rootimgdir/$compressedrootimg "; + "imgurl=" . rootimg_url($httpmethod, $imgsrv, $httpport, $rootimgdir, $compressedrootimg) . " "; $kcmdline .= $checksum_arg; $kcmdline .= $uftp_args; } @@ -1158,13 +1194,7 @@ sub mkinstall $httpprefix =~ s/^$installroot/\/install/; } my $kcmdline = - "autoyast=$httpmethod://" - . $netserver . ":" . $httpport - . "/install/autoinst/" - . $node - . " install=$httpmethod://" - . $netserver . ":" . $httpport - . "$httpprefix/1"; + autoyast_boot_args($httpmethod, $netserver, $httpport, $httpprefix, $node); if ($os =~ /^leap15/) { $kcmdline .= " self_update=0"; }