Debian: KS: Fix mgmt vlan support for system node installs
The kickstart is not quering system inventory for the management vlan if the boot interface name lookup succeeds. This update modifies the logic to perform the system inventory vlan query for system node installs even if the boot interface name lookup succeeds. LAT does not support pxecontroller address translation in a chroot environment and post chroot hooks are executed before post nochroot hooks. Therefore, this update had to move the entire interface setup kickstart segment to a nochroot hook. Note: This change does not impact CentOS env. Test Plan: PASS: Verify Debian build and Install in vbox and RealHw PASS: Verify platform.conf is updated with vlan<id> if system inventory mgmtvlan query returns a vlan id. PASS: Verify interface.d interface setup files are correct for ipv4 with and without vlan. Regression: PASS: Verify system host-reinstall controller-1 PASS: Verify system host-swact controller-0 PASS: Verify system host-lock controller-0 PASS: Verify system host-reinstall controller-0 PASS: Verify system host-unlock controller-0 PASS: Verify platform.conf is updated with management interface name if system inventory mgmtvlan query returns nothing. Depends-On: https://review.opendev.org/c/starlingx/tools/+/852029 Story: 2009968 Task: 45895 Signed-off-by: Eric MacDonald <eric.macdonald@windriver.com> Change-Id: I24eb5d2b2bcc7d9852fda75a27ef9f07e3b75df4
This commit is contained in:
parent
004eea6acd
commit
c13f94e48b
@ -1841,7 +1841,7 @@ true
|
||||
|
||||
###########################################################################
|
||||
|
||||
%post --interpreter=/bin/bash
|
||||
%post --interpreter=/bin/bash --nochroot
|
||||
HOOK_LABEL="post"
|
||||
. /tmp/lat/ks_functions.sh
|
||||
|
||||
@ -1869,42 +1869,41 @@ if [ -n "$BOOTIF" ] ; then
|
||||
# convert to predictive name
|
||||
mgmt_dev=$(get_iface_from_ethname $ndev)
|
||||
if [ "${mgmt_dev}" == "" ] ; then
|
||||
elog "failed to get predictive altname from ${ndev}"
|
||||
mgmt_dev=${ndev}
|
||||
|
||||
# get vlan info for system node installs
|
||||
system_node=$(is_system_node_install)
|
||||
if [ "${system_node}" = true ] ; then
|
||||
# Retrieve the management VLAN from sysinv if it exists
|
||||
ilog "Querying system inventory for management vlan id"
|
||||
mgmt_vlan=`curl -sf http://pxecontroller:6385/v1/isystems/mgmtvlan`
|
||||
if [ ${?} -ne 0 ] ; then
|
||||
# TODO: uncomment to force install failure for product
|
||||
# report_failure_with_msg "Unable to communicate with System Inventory REST API. Aborting installation."
|
||||
wlog "ERROR: Unable to communicate with System Inventory REST API."
|
||||
fi
|
||||
report_failure_with_msg "failed to get predictive altname from ${ndev}"
|
||||
fi
|
||||
# get vlan info for system node installs
|
||||
if is_system_node_install -eq 0 ; then
|
||||
# Retrieve the management VLAN from sysinv if it exists
|
||||
ilog "Querying system inventory for management vlan id"
|
||||
mgmt_vlan=`curl -sf http://pxecontroller:6385/v1/isystems/mgmtvlan`
|
||||
rc=$?
|
||||
if [ ${rc} -ne 0 ] ; then
|
||||
report_failure_with_msg "Unable to communicate with System Inventory REST API. Aborting installation. rc:${rc}"
|
||||
fi
|
||||
ilog "Management Interface: ${ndev} -> ${mgmt_dev} -> vlan${mgmt_vlan}"
|
||||
else
|
||||
ilog "Management Interface: ${ndev} -> ${mgmt_dev}"
|
||||
fi
|
||||
else
|
||||
elog "ERROR:POST: Unable to determine mgmt interface from BOOTIF=$BOOTIF."
|
||||
report_failure_with_msg "Unable to determine mgmt interface from BOOTIF=$BOOTIF."
|
||||
fi
|
||||
else
|
||||
wlog "BOOTIF is not set. Unable to determine mgmt interface."
|
||||
fi
|
||||
|
||||
if [ ! -e "/etc/network/interfaces" ] ; then
|
||||
cat << EOF >> /etc/network/interfaces
|
||||
ilog "mgmt_dev : $mgmt_dev"
|
||||
ilog "mgmt_vlan: $mgmt_vlan"
|
||||
|
||||
if [ ! -e "${IMAGE_ROOTFS}/etc/network/interfaces" ] ; then
|
||||
cat << EOF >> ${IMAGE_ROOTFS}/etc/network/interfaces
|
||||
# This file describes the network interfaces available on the system
|
||||
# and how to activate them. For more information , see interfaces(5)
|
||||
source /etc/network/interfaces.d/*
|
||||
source ${IMAGE_ROOTFS}/etc/network/interfaces.d/*
|
||||
EOF
|
||||
fi
|
||||
|
||||
if [ ! -d "/etc/network/interfaces.d" ] ; then
|
||||
mkdir -p -m 0775 /etc/network/interfaces.d
|
||||
if [ ! -d "${IMAGE_ROOTFS}/etc/network/interfaces.d" ] ; then
|
||||
mkdir -p -m 0775 ${IMAGE_ROOTFS}/etc/network/interfaces.d
|
||||
fi
|
||||
|
||||
ilog "Setup network scripts"
|
||||
@ -1916,13 +1915,13 @@ if [ $mgmt_vlan -eq 0 ] ; then
|
||||
update_platform_conf "management_interface=$mgmt_dev"
|
||||
|
||||
# Build networking scripts
|
||||
cat << EOF > /etc/network/interfaces.d/ifcfg-lo
|
||||
cat << EOF > ${IMAGE_ROOTFS}/etc/network/interfaces.d/ifcfg-lo
|
||||
auto lo
|
||||
iface lo inet loopback
|
||||
EOF
|
||||
|
||||
if [ $mgmt_dev != "lo" ]; then
|
||||
cat << EOF > /etc/network/interfaces.d/ifcfg-$mgmt_dev
|
||||
cat << EOF > ${IMAGE_ROOTFS}/etc/network/interfaces.d/ifcfg-$mgmt_dev
|
||||
auto $mgmt_dev
|
||||
iface $mgmt_dev inet dhcp
|
||||
post-up echo 0 > /proc/sys/net/ipv6/conf/lo/autoconf; echo 0 > /proc/sys/net/ipv6/conf/lo/accept_ra; echo 0 > /proc/sys/net/ipv6/conf/lo/accept_redirects
|
||||
@ -1951,7 +1950,7 @@ else
|
||||
update_platform_conf "management_interface=vlan$mgmt_vlan"
|
||||
|
||||
# Build networking scripts
|
||||
cat << EOF > /etc/network/interfaces.d/ifcfg-lo
|
||||
cat << EOF > ${IMAGE_ROOTFS}/etc/network/interfaces.d/ifcfg-lo
|
||||
auto lo
|
||||
iface lo $mgmt_address_family static
|
||||
address 127.0.0.1
|
||||
@ -1959,18 +1958,43 @@ netmask 255.0.0.0
|
||||
post-up echo 0 > /proc/sys/net/ipv6/conf/lo/autoconf; echo 0 > /proc/sys/net/ipv6/conf/lo/accept_ra; echo 0 > /proc/sys/net/ipv6/conf/lo/accept_redirects
|
||||
EOF
|
||||
|
||||
cat << EOF > /etc/network/interfaces.d/ifcfg-$mgmt_dev
|
||||
cat << EOF > ${IMAGE_ROOTFS}/etc/network/interfaces.d/ifcfg-$mgmt_dev
|
||||
auto $mgmt_dev
|
||||
iface $mgmt_dev $mgmt_address_family manual
|
||||
post-up echo 0 > /proc/sys/net/ipv6/conf/lo/autoconf; echo 0 > /proc/sys/net/ipv6/conf/lo/accept_ra; echo 0 > /proc/sys/net/ipv6/conf/lo/accept_redirects
|
||||
EOF
|
||||
|
||||
cat << EOF > /etc/network/interfaces.d/ifcfg-vlan$mgmt_vlan
|
||||
cat << EOF > ${IMAGE_ROOTFS}/etc/network/interfaces.d/ifcfg-vlan$mgmt_vlan
|
||||
auto vlan$mgmt_vlan
|
||||
iface vlan$mgmt_vlan $mgmt_address_family dhcp
|
||||
vlan-raw-device $mgmt_dev
|
||||
post-up echo 0 > /proc/sys/net/ipv6/conf/lo/autoconf; echo 0 > /proc/sys/net/ipv6/conf/lo/accept_ra; echo 0 > /proc/sys/net/ipv6/conf/lo/accept_redirects
|
||||
EOF
|
||||
|
||||
# Reject DHCPOFFER from DHCP server that doesn't send
|
||||
# wrs-install-uuid option
|
||||
echo "require wrs-install-uuid;" >>/etc/dhcp/dhclient.conf
|
||||
echo "require dhcp6.wrs-install-uuid;" >>/etc/dhcp/dhclient.conf
|
||||
|
||||
# Bring up the mgmt vlan so that a dhcp lease is acquired and an address is
|
||||
# setup prior to the post-install reboot. This is so that the timing of the IP
|
||||
# address allocation is similar to how normal/non-pxe installation works.
|
||||
mgmt_iface=vlan$mgmt_vlan
|
||||
ilog "mgmt_iface=vlan$mgmt_vlan"
|
||||
ilog "mgmt_address_family: $mgmt_address_family"
|
||||
|
||||
dhclient_family=$([[ $mgmt_address_family == "inet" ]] && echo -4 || echo -6)
|
||||
ilog "dhclient_family: $dhclient_family"
|
||||
ilog "ip link add link $mgmt_dev name $mgmt_iface type vlan id $mgmt_vlan"
|
||||
|
||||
ip link add link $mgmt_dev name $mgmt_iface type vlan id $mgmt_vlan
|
||||
|
||||
ilog "ip link set up dev $mgmt_iface"
|
||||
ilog "dhclient $dhclient_family $mgmt_iface || true"
|
||||
|
||||
ip link set up dev $mgmt_iface
|
||||
dhclient $dhclient_family $mgmt_iface || true
|
||||
|
||||
fi
|
||||
|
||||
true
|
||||
|
Loading…
Reference in New Issue
Block a user