mirror of
https://github.com/xcat2/xcat-core.git
synced 2026-12-03 07:37:05 +00:00
Merge remote-tracking branch 'origin/fix/genesis-dhcp6-secondary-nic-reservation' into releases/2.20.0-rc9
This commit is contained in:
@@ -238,6 +238,18 @@ genesis_nic_has_global_v6() {
|
||||
ip -6 -o addr show dev "$nic" 2>/dev/null | grep -v 'scope link' | grep -q inet6
|
||||
}
|
||||
|
||||
genesis_nic_has_global_v4() {
|
||||
local nic="$1"
|
||||
ip -4 -o addr show dev "$nic" 2>/dev/null | grep -v 'scope link' | grep -q inet
|
||||
}
|
||||
|
||||
# xcatd is reached over whichever family the provisioning network serves, so net init is over
|
||||
# when the boot nic holds an address of either one.
|
||||
genesis_nic_has_address() {
|
||||
local nic="$1"
|
||||
genesis_nic_has_global_v4 "$nic" || genesis_nic_has_global_v6 "$nic"
|
||||
}
|
||||
|
||||
# Wait for one nic to hold a routable IPv6 address. Returns non-zero after the last try, which
|
||||
# on an IPv4-only network is every time.
|
||||
genesis_wait_nic_v6() {
|
||||
@@ -417,10 +429,10 @@ else
|
||||
|
||||
gripeiter=101
|
||||
logger -s -t $log_label -p local4.info "Acquiring network addresses.."
|
||||
while ! ip -4 -o a show dev $bootnic|grep -v 'scope link'|grep -q inet; do
|
||||
while ! genesis_nic_has_address "$bootnic"; do
|
||||
sleep 0.1
|
||||
if [ $gripeiter = 1 ]; then
|
||||
logger -s -t $log_label -p local4.info "It seems to be taking a while to acquire an IPv4 address, you may want to check spanning tree..."
|
||||
logger -s -t $log_label -p local4.info "It seems to be taking a while to acquire an address, you may want to check spanning tree..."
|
||||
fi
|
||||
gripeiter=$((gripeiter-1))
|
||||
done
|
||||
@@ -432,9 +444,13 @@ touch /tmp/netinitted
|
||||
|
||||
openssl genrsa -out /etc/xcat/certkey.pem 4096 > /dev/null 2>&1 &
|
||||
|
||||
logger -s -t $log_label -p local4.info "Acquired IPv4 address on $bootnic"
|
||||
|
||||
ip -4 -o a show dev $bootnic|grep -v 'scope link'|grep -v 'dynamic'|awk '{print $4}'
|
||||
if genesis_nic_has_global_v4 "$bootnic"; then
|
||||
logger -s -t $log_label -p local4.info "Acquired IPv4 address on $bootnic"
|
||||
ip -4 -o addr show dev $bootnic|grep -v 'scope link'|grep -v 'dynamic'|awk '{print $4}'
|
||||
else
|
||||
logger -s -t $log_label -p local4.info "Acquired IPv6 address on $bootnic"
|
||||
ip -6 -o addr show dev $bootnic|grep -v 'scope link'|awk '{print $4}'
|
||||
fi
|
||||
|
||||
if [ -e /usr/sbin/ntpd ]; then
|
||||
logger -s -t $log_label -p local4.info "Starting ntpd..."
|
||||
|
||||
@@ -63,3 +63,11 @@ dhcp6_nics()
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$output" = 2 ]
|
||||
}
|
||||
|
||||
@test "the boot nic finishes net init with an IPv6 address and no IPv4 address" {
|
||||
# The provisioning network of an IPv6 cell declares no IPv4 pool, so no IPv4 address can
|
||||
# arrive. doxcat has to go on with the address it has, or Genesis never reaches xcatd.
|
||||
: >"$fixture/addrs4/boot0"
|
||||
printf '2: boot0 inet6 2001:db8:188::20/64 scope global\n' >"$fixture/addrs6/boot0"
|
||||
boot_genesis
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ setup_doxcat()
|
||||
local utility fips library
|
||||
fips=$(repo_path xCAT-genesis-scripts/usr/lib/xcat/fips.sh)
|
||||
[ -r "$fips" ]
|
||||
mkdir -p "$fixture"/{etc/ssh,etc/pki/tls,real,links,addrs,addrs6}
|
||||
mkdir -p "$fixture"/{etc/ssh,etc/pki/tls,real,links,addrs,addrs4,addrs6}
|
||||
# chmod is in this list because doxcat runs it: the sandbox has no /usr/bin on PATH, so a
|
||||
# command that is missing here is a command that silently does nothing under test. doxcat's
|
||||
# chmod of the sshd privilege separation directory was not exercised until it was added.
|
||||
@@ -56,10 +56,15 @@ case "$*" in
|
||||
'-o addr show dev '*)
|
||||
[ ! -e "/run/fixture/addrs/$5.fail" ] || exit 19
|
||||
cat "/run/fixture/addrs/$5" ;;
|
||||
'-6 -o addr show dev '*)
|
||||
'-6 -o a show dev '*|'-6 -o addr show dev '*)
|
||||
[ ! -e "/run/fixture/addrs6/$6.fail" ] || exit 19
|
||||
cat "/run/fixture/addrs6/$6" ;;
|
||||
'-4 -o a show dev '*) printf '2: %s inet 192.0.2.20/24 scope global\n' "$6" ;;
|
||||
'-4 -o a show dev '*|'-4 -o addr show dev '*)
|
||||
if [ -e "/run/fixture/addrs4/$6" ]; then
|
||||
cat "/run/fixture/addrs4/$6"
|
||||
else
|
||||
printf '2: %s inet 192.0.2.20/24 scope global\n' "$6"
|
||||
fi ;;
|
||||
*) printf 'unexpected ip %s\n' "$*" >&2; exit 97 ;;
|
||||
esac
|
||||
SH
|
||||
|
||||
Reference in New Issue
Block a user