2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-11-21 18:02:18 +00:00
Files
xcat-core/xCAT/postscripts/xcatpostinit1.netboot
T
Vinícius Ferrão 3928c04507 feat(ipv6): add EL10 IPv6-only provisioning support
An IPv6-only provisioning network cannot deploy a node. The discovery and
credential callbacks open IPv4 sockets, the kickstart and boot templates
render an IPv4 address into every endpoint, and makehosts drops an IPv6
value because hosts.pm gates on isIpv4addr.

NetworkUtils gains the address helpers the rest of the change uses:
format_host_port, parse_host_port and format_uri_host bracket an IPv6
literal, getNodeNetworkCfg6 reads the static IPv6 configuration of a node,
my_ip_facing_family selects the management-node address of one family,
getIPv6ReverseZone builds a nibble-aligned reverse zone, and
node_is_ipv6_only and ipv6_server_for_node answer the two questions the
plugins used to answer for themselves. credentials.pm opens the callback
socket through IO::Socket::INET6 when the modules are present and keeps the
IPv4 path when they are not. Template.pm and anaconda.pm render an IPv6
kickstart network line and bracketed endpoints. The postscripts and the
stateless xcatroot format every endpoint through the bracketing helpers.

xCAT-server requires perl-IO-Socket-INET6 and perl-Socket6 on EL, and
libio-socket-inet6-perl and libsocket6-perl on Debian.

(cherry picked from commits c0a69bb5a and caa8ca790)
Ported onto upstream master ee6b4f532. The two commits are folded because the
second refactors the first. Master is kept where it has a newer form of the
same thing: the getipaddr cache guard, the Kea control_socket_path helper, the
netboot method list, install_device_params, the modern_installer test and the
isValidIp validator, which replaces the isValidIPAddress this branch added.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-21 18:59:05 -03:00

105 lines
3.0 KiB
Bash
Executable File

#!/bin/bash
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
# chkconfig: 345 84 59
# description: the hook in systemd service unit to run PB or report node status on diskless & statelite node
# processname: xcatpostinit1
### BEGIN INIT INFO
# Provides: xcatpostinit
# Default-Start: 3 4 5
# Default-stop: 0 1 2 6
# Required-Start: gettyset
# Required-Stop:
# Short-Description: xCATpost
# Description: xCAT post boot script
### END INIT INFO
# Source function library.
if [ -x /etc/rc.d/init.d/functions ]; then
. /etc/rc.d/init.d/functions
fi
if [ -n "$LOGLABEL" ]; then
log_label=$LOGLABEL
else
log_label="xcat.deployment"
fi
xcat_endpoint_host()
{
local endpoint="$1"
local remainder
case "$endpoint" in
\[*\]:*)
endpoint=${endpoint#\[}
printf '%s\n' "${endpoint%%\]*}"
;;
*:*)
remainder=${endpoint#*:}
if [[ "$remainder" == *:* ]]; then
printf '%s\n' "$endpoint"
else
printf '%s\n' "${endpoint%%:*}"
fi
;;
*)
printf '%s\n' "$endpoint"
;;
esac
}
XCATENDPOINT=$(grep --only-matching "\<XCAT=[^ ]*\>" /proc/cmdline | cut -d= -f2 2>/dev/null)
XCATSERVER=$(xcat_endpoint_host "$XCATENDPOINT")
logger -t $log_label -p local4.info "$0: action is $1"
case $1 in
restart)
$0 stop
$0 start
;;
status)
echo -n "xcatpostinit runs only at boot, runs additional post scripts"
logger -t $log_label -p local4.info "xcatpostinit runs only at boot, runs additional post scripts"
;;
stop)
echo -n "nothing to stop "
logger -t $log_label -p local4.info "nothing to stop"
grep nonodestatus /proc/cmdline 2>/dev/null || [ -n "$XCATSERVER" ] && /xcatpost/updateflag.awk "$XCATSERVER" 3002 "installstatus powering-off"
;;
start)
# Node is stateless by default
STATELITE=0
# Node is statelite if /proc/cmdline have flag `STATEMNT='
STATELITE_FLAG="STATEMNT="
# Script to direct further actions
SCRIPT="/opt/xcat/xcatdsklspost"
# Usefull information passed as kernel arguments
if [ -f "/proc/cmdline" ]; then
if grep --quiet --no-messages "$STATELITE_FLAG" "/proc/cmdline"; then
STATELITE=1
fi
fi
# Test for script existance
if ! [ -x "$SCRIPT" ]; then
logger -t $log_label -p local4.info "Unable to locate script $SCRIPT."
grep nonodestatus /proc/cmdline 2>/dev/null || [ -n "$XCATSERVER" ] && /xcatpost/updateflag.awk "$XCATSERVER" 3002 "installstatus failed"
exit -1
fi
# Run $SCRIPT according to node type
grep nonodestatus /proc/cmdline 2>/dev/null || [ -n "$XCATSERVER" ] && /xcatpost/updateflag.awk "$XCATSERVER" 3002 "installstatus postbooting"
if [ $STATELITE -ne 0 ]; then
logger -t $log_label -p local4.info "Call $SCRIPT for statelite mode"
"$SCRIPT" 4
else
logger -t $log_label -p local4.info "Call $SCRIPT for stateless mode"
"$SCRIPT"
fi
;;
esac