From 9e94f1834a351bfe058e80b35f867ce435dacc5d Mon Sep 17 00:00:00 2001 From: Kyle MacLeod Date: Thu, 15 Jun 2023 20:52:22 -0400 Subject: [PATCH] Fix ip -6 address netmask and workaround for multi-drivers-switch This commit fixes the missing support for bootstrap_address_prefix in the miniboot ip -6 address add command. We check for the provided prefix value parsed from the boot arguments and make sure that it is applied if present. Note that the bootstrap_address_prefix is a mandatory install value, so it will be provided. However, we leave the capability for it to be missing, in order to de-risk this commit. Additionally, a workaround is included for full support of multi-drivers-switch given in the boot arguments. When this argument is given we parse out the kernel module version and use it to replace the current kernel modules for ice/i40e/iavf with the modules of the given version. Test Plan PASS: - Replace miniboot.cfg at /var/miniboot/kickstart-override/miniboot.cfg on target lab system requiring multi-drivers-switch=cvl-2.54: - Using subcloud install-value extra_boot_params: multi-drivers-switch=cvl-2.54, verify that the subcloud switches to the legacy kernel modules and the subcloud is able to properly configure its IP address and perform the ostree pull operation from the system controller. - Install subcloud with no extra_boot_params, verify that the bootstrap_address_prefix is properly applied. Verify no regression. Closes-Bug: 2023407 Signed-off-by: Kyle MacLeod Change-Id: I4f3d8e2f240f2aa061de30014cf39dfb9b42a035 --- kickstart/files/miniboot.cfg | 53 +++++++++++++++++++++++++++++++++--- 1 file changed, 49 insertions(+), 4 deletions(-) diff --git a/kickstart/files/miniboot.cfg b/kickstart/files/miniboot.cfg index 58ad6851..4dc41378 100644 --- a/kickstart/files/miniboot.cfg +++ b/kickstart/files/miniboot.cfg @@ -1529,6 +1529,39 @@ done # Override installer variable to not prompt for erasing the disk export INSTW=0 +# If multi-drivers-switch= is in boot parameters then we need to revert the +# kernel modules to the legacy version. This is a workaround for the LAT +# /install script not supporting multi-drivers-switch +driver_version= +if grep -s -q '\smulti-drivers-switch=' /proc/cmdline ; then + for arg in $(cat /proc/cmdline); do + case "${arg}" in + multi-drivers-switch=*) + driver_version=${arg##*=} + break + ;; + esac + done + # Only proceed if we have a valid driver_version + if [ -n "${driver_version}" ] && \ + [ -f "/lib/modules/$(uname -r)/extra/ice-${driver_version}/ice.ko" ] && \ + [ -f "/lib/modules/$(uname -r)/extra/i40e-${driver_version}/i40e.ko" ] && \ + [ -f "/lib/modules/$(uname -r)/extra/iavf-${driver_version}/iavf.ko" ]; then + ilog "Found multi-drivers-switch: replacing ice/i40e/iavf with driver_version='${driver_version}'" + modprobe -r ice + modprobe -r i40e + modprobe -r iavf + sleep 2 + insmod "/lib/modules/$(uname -r)/extra/ice-${driver_version}/ice.ko" + insmod "/lib/modules/$(uname -r)/extra/i40e-${driver_version}/i40e.ko" + insmod "/lib/modules/$(uname -r)/extra/iavf-${driver_version}/iavf.ko" + sleep 2 + ilog "Finished multi-drivers-switch module replacement" + else + elog "Found multi-drivers-switch but no modules exist for driver_version='${driver_version}' (ignoring)" + fi +fi + ilog "Setting up initial IP address for ostree pull" parse_miniboot_network_params @@ -1542,8 +1575,14 @@ if [ -z "${mgmt_vlan}" ] ; then ilog "ip ${BOOTPARAM_IP_VER} address add ${BOOTPARAM_IP_ADDR}/${BOOTPARAM_PREFIX_LEN} dev ${mgmt_dev}" ip ${BOOTPARAM_IP_VER} address add ${BOOTPARAM_IP_ADDR}/${BOOTPARAM_PREFIX_LEN} dev ${mgmt_dev} else - ilog "ip ${BOOTPARAM_IP_VER} address add ${BOOTPARAM_IP_ADDR} dev ${mgmt_dev}" - ip ${BOOTPARAM_IP_VER} address add ${BOOTPARAM_IP_ADDR} dev ${mgmt_dev} + # BOOTPARAM_PREFIX_LEN should not be empty, but guard against it: + if [ -z "${BOOTPARAM_PREFIX_LEN}" ]; then + ilog "ip ${BOOTPARAM_IP_VER} address add ${BOOTPARAM_IP_ADDR} dev ${mgmt_dev}" + ip ${BOOTPARAM_IP_VER} address add ${BOOTPARAM_IP_ADDR} dev ${mgmt_dev} + else + ilog "ip ${BOOTPARAM_IP_VER} address add ${BOOTPARAM_IP_ADDR}/${BOOTPARAM_PREFIX_LEN} dev ${mgmt_dev}" + ip ${BOOTPARAM_IP_VER} address add ${BOOTPARAM_IP_ADDR}/${BOOTPARAM_PREFIX_LEN} dev ${mgmt_dev} + fi fi ilog "ip ${BOOTPARAM_IP_VER} link set dev ${mgmt_dev} up" ip ${BOOTPARAM_IP_VER} link set dev ${mgmt_dev} up @@ -1577,8 +1616,14 @@ else ilog "ip ${BOOTPARAM_IP_VER} address add ${BOOTPARAM_IP_ADDR}/${BOOTPARAM_PREFIX_LEN} dev ${mgmt_iface}" ip ${BOOTPARAM_IP_VER} address add ${BOOTPARAM_IP_ADDR}/${BOOTPARAM_PREFIX_LEN} dev ${mgmt_iface} else - ilog "ip ${BOOTPARAM_IP_VER} address add ${BOOTPARAM_IP_ADDR} dev ${mgmt_iface}" - ip ${BOOTPARAM_IP_VER} address add ${BOOTPARAM_IP_ADDR} dev ${mgmt_iface} + # BOOTPARAM_PREFIX_LEN should not be empty, but guard against it: + if [ -z "${BOOTPARAM_PREFIX_LEN}" ]; then + ilog "ip ${BOOTPARAM_IP_VER} address add ${BOOTPARAM_IP_ADDR} dev ${mgmt_iface}" + ip ${BOOTPARAM_IP_VER} address add ${BOOTPARAM_IP_ADDR} dev ${mgmt_iface} + else + ilog "ip ${BOOTPARAM_IP_VER} address add ${BOOTPARAM_IP_ADDR}/${BOOTPARAM_PREFIX_LEN} dev ${mgmt_iface}" + ip ${BOOTPARAM_IP_VER} address add ${BOOTPARAM_IP_ADDR}/${BOOTPARAM_PREFIX_LEN} dev ${mgmt_iface} + fi fi ilog "ip ${BOOTPARAM_IP_VER} link set up dev ${mgmt_dev}" ip ${BOOTPARAM_IP_VER} link set up dev ${mgmt_dev}