mirror of
https://github.com/xcat2/xcat-core.git
synced 2026-11-28 21:32:20 +00:00
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>
This commit is contained in:
@@ -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:
|
||||
"<address>:<port>", 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;
|
||||
|
||||
@@ -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";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user