diff --git a/kickstart/files/kickstart.cfg b/kickstart/files/kickstart.cfg index a730a25b..a7d917c1 100644 --- a/kickstart/files/kickstart.cfg +++ b/kickstart/files/kickstart.cfg @@ -20,7 +20,6 @@ # storage ... the storage function # worker ... the worker function # lowlatency ... the low latency function -# miniboot ... redfish subcloud install function # # Valid node personality trait groupings ... set configuration function # @@ -98,24 +97,24 @@ export LOGFILE="/\${LAT_DIR}/kickstart.log" function log() { local dt="\$(date "+%Y-%m-%d %H:%M:%S.%3N")" - echo "\$dt kickstart \${HOOK_LABEL} info: \$1" >>\${LOGFILE} + echo "\$dt kickstart \${HOOK_LABEL} info: \${prefix} \$1" >>\${LOGFILE} } function ilog() { - [ -z "$stdout" ] && stdout=1 - local dt="$(date "+%Y-%m-%d %H:%M:%S.%3N")" - echo "\$dt kickstart \${HOOK_LABEL} info: \$1" >&\${stdout} - echo "\$dt kickstart \${HOOK_LABEL} info: \$1" >>\${LOGFILE} + [ -z "\${stdout}" ] && stdout=1 + local dt="\$(date "+%Y-%m-%d %H:%M:%S.%3N")" + echo "\$dt kickstart \${HOOK_LABEL} info: \${prefix} \$1" >&\${stdout} + echo "\$dt kickstart \${HOOK_LABEL} info: \${prefix} \$1" >>\${LOGFILE} } function dlog() { - if [ "\${debug}" ] ; then + if [ \${debug} -ne 0 ] ; then [ -z "\$stdout" ] && stdout=1 local dt="\$(date "+%Y-%m-%d %H:%M:%S.%3N")" - echo "\$dt kickstart \${HOOK_LABEL} debug: \$1" >&\${stdout} - echo "\$dt kickstart \${HOOK_LABEL} debug: \$1" >>\${LOGFILE} + echo "\$dt kickstart \${HOOK_LABEL} debug: \${prefix} \$1" >&\${stdout} + echo "\$dt kickstart \${HOOK_LABEL} debug: \${prefix} \$1" >>\${LOGFILE} fi } @@ -123,24 +122,34 @@ function wlog() { [ -z "\$stdout" ] && stdout=1 local dt="\$(date "+%Y-%m-%d %H:%M:%S.%3N")" - echo "\$dt kickstart \${HOOK_LABEL} warn: \$1" >&\${stdout} - echo "\$dt kickstart \${HOOK_LABEL} warn: \$1" >>\${LOGFILE} + echo "\$dt kickstart \${HOOK_LABEL} warn: \${prefix} \$1" >&\${stdout} + echo "\$dt kickstart \${HOOK_LABEL} warn: \${prefix} \$1" >>\${LOGFILE} } function elog() { [ -z "\$stdout" ] && stdout=1 local dt="\$(date "+%Y-%m-%d %H:%M:%S.%3N")" - echo "\$dt kickstart \${HOOK_LABEL} error: \$1" >&\${stdout} - echo "\$dt kickstart \${HOOK_LABEL} error: \$1" >>\${LOGFILE} + echo "\$dt kickstart \${HOOK_LABEL} error: \${prefix} \$1" >&\${stdout} + echo "\$dt kickstart \${HOOK_LABEL} error: \${prefix} \$1" >>\${LOGFILE} } +######################################################################## +# Name : report_failure_with_msg +# Purpose : Report installation error, offer a console and +# reboot on exit. +# Parameters: \$1 is the failure message string +# Return : Does not return +######################################################################## function report_failure_with_msg() { local msg=\${1} echo -e '\n\nInstallation failed.\n' wlog "Installation Failed: ERROR: \${msg}" - exit 1 + echo "... dropping to shell ; exit to reboot ..." + sleep 1 + bash + reboot -f } ######################################################################## @@ -219,12 +228,12 @@ function exec_retry() local ret_code=0 local ret_stdout="" - command="\${command}" # 2>&\$stdout" - while [ \$retry_count -le \$retries ]; do + command="\${command}" # 2>&\${stdout}" + while [ \${retry_count} -le \${retries} ]; do # dlog "Running command: '\${command}'." ret_stdout=\$(eval \${command}) ret_code=\${?} - [ \$ret_code -eq 0 ] && break + [ \${ret_code} -eq 0 ] && break wlog "Error running command '\${command}'. Try \${retry_count} of \${retries} retry in \${interval}s." wlog "ret_code: \${ret_code}, stdout: '\${ret_stdout}'." sleep \${interval} @@ -254,16 +263,16 @@ function exec_no_fds() local ret_code=0 local ret_stdout="" - for fd in \$fds + for fd in \${fds} do - local cmd="\$cmd \$fd>&-" + local cmd="\${cmd} \$fd>&-" done - if [ -z "\$retries" ]; then - #wlog "Running command: '\$cmd'." - eval "\$cmd" + if [ -z "\${retries}" ]; then + #wlog "Running command: '\${cmd}'." + eval "\${cmd}" else - ret_stdout=\$(exec_retry "\$retries" "\$interval" "\$cmd") - ret_code=\$? + ret_stdout=\$(exec_retry "\${retries}" "\${interval}" "\${cmd}") + ret_code=\${?} echo "\${ret_stdout}" return \${ret_code} fi @@ -271,11 +280,27 @@ function exec_no_fds() ######################################################################### # Name : is_system_node_install -# Returns : 1 if yes 'pxecontroller' is in $insturl boot arg ; else 0 +# Returns : true : 0 if 'pxecontroller' is in $insturl boot arg +# false: 1 ######################################################################### function is_system_node_install() { - if [[ "\$insturl" == *"pxecontroller"* ]] ; then + if [[ "\${insturl}" == *"pxecontroller"* ]] ; then + return 0 + else + return 1 + fi +} + +######################################################################### +# Name : is_usb_install +# Returns : true :0 +# false:1 +######################################################################### +function is_usb_install() +{ + pxeurl=\$(echo \${insturl} | sed -e s/ostree_repo//) + if [ "\${pxeurl}" = "file://NOT_SET" ] ; then return 0 else return 1 @@ -342,19 +367,19 @@ function get_iface_from_ethname() function display_volume_info () { if [ \${debug} -ne 0 ] ; then - ilog "Volume Info:\${1}" + ilog "Volume Info:\${1}" - pvscan 2>/dev/null - pvscan 2>/dev/null >> \${LOGFILE} + pvscan 2>/dev/null + pvscan 2>/dev/null >> \${LOGFILE} - lvscan 2>/dev/null - lvscan 2>/dev/null >> \${LOGFILE} + lvscan 2>/dev/null + lvscan 2>/dev/null >> \${LOGFILE} - pvdisplay 2>/dev/null - pvdisplay 2>/dev/null >> \${LOGFILE} + pvdisplay 2>/dev/null + pvdisplay 2>/dev/null >> \${LOGFILE} - lvdisplay 2>/dev/null - lvdisplay 2>/dev/null >> \${LOGFILE} + lvdisplay 2>/dev/null + lvdisplay 2>/dev/null >> \${LOGFILE} fi } @@ -406,7 +431,7 @@ function clr_variable() ######################################################################### function get_aio_controller_provisioning_sizes() { - gb=$((1024*1024*1024)) + gb=\$((1024*1024*1024)) ## ## NOTE: updates to partition sizes need to be also reflected in @@ -506,11 +531,11 @@ function get_aio_controller_provisioning_sizes() ilog "install disk size:\$sz gb:\$gb" # Round MINIMUM_PLATFORM_PV_SIZE to the closest upper value that can be divided by 1024. - if [ \$sz -gt \$((\$default_small_disk_size*\$gb)) ] ; then + if [ \${sz} -gt \$((\${default_small_disk_size}*\${gb})) ] ; then ilog "Large disk: MINIMUM_PLATFORM_PV_SIZE=179GiB*1024=183296" export MINIMUM_PLATFORM_PV_SIZE=183296 - elif [ \$sz -ge \$((\$minimum_small_disk_size*\$gb)) ] ; then + elif [ \${sz} -ge \$((\${minimum_small_disk_size}*\${gb})) ] ; then ilog "Small disk: MINIMUM_PLATFORM_PV_SIZE=164GiB*1024=167936" export MINIMUM_PLATFORM_PV_SIZE=167936 @@ -536,6 +561,30 @@ function get_std_controller_provisioning_sizes() export SCRATCH_VOL_SIZE=16000 } +function get_worker_provisioning_sizes() +{ + gb=\$((1024*1024*1024)) + + export LOG_VOL_SIZE=4000 + export SCRATCH_VOL_SIZE=4000 + + ## LOG_VOL_SIZE = 4096 + ## SCRATCH_VOL_SIZE = 4096 + ## DOCKER = 30720 + ## CEPH_MON = 20480 + ## KUBELET_VOL_SIZE = 10240 + ## RESERVED_PE = 16 (based on pesize=32768) + ## + ## CGTS_PV_SIZE = 4096 + 4096 + 30720 + 20480 + 10240 + 16 = 69648 + ## + ## Round CGTS_PV_SIZE to the closest upper value that can be divided by 1024. + ## 69648/1024=68.01. CGTS_PV_SIZE=69*1024=70656. + export CGTS_PV_SIZE=70656 + + sz=\$(blockdev --getsize64 \${INSTDEV}) + ilog "install disk size:\${sz} gb:\${gb}" +} + ########################################################################## # Global Kickstart Constants # @@ -544,28 +593,30 @@ function get_std_controller_provisioning_sizes() # NOTE: exported Variables from other segments are NOT visible from functions # -if [ "${INSTFLUX}" = 0 ] ; then - BACKUP_PART_NO=5 # in base_bullseye.yaml, instflux=0 -else - BACKUP_PART_NO=6 # in base_bullseye.yaml, instflux=1 or not set +if [ "\${controller}" = true ] ; then + if [ "\${INSTFLUX}" = 0 ] ; then + BACKUP_PART_NO=5 # in base_bullseye.yaml, instflux=0 + else + BACKUP_PART_NO=6 # in base_bullseye.yaml, instflux=1 or not set + fi + case \${INSTDEV} in + *"nvme"*) + BACKUP_PART=\${INSTDEV}p\${BACKUP_PART_NO} + ;; + *) + BACKUP_PART=\${INSTDEV}\${BACKUP_PART_NO} + ;; + esac + BACKUP_PART_LABEL="platform_backup" + + DEFAULT_PERSISTENT_SIZE=30000 + + # Note that the BA5EBA11-0000-1111-2222- is the prefix used by STX and it's + # defined in sysinv constants.py. Since the 000000000001 suffix is used by + # custom stx LVM partitions, the next suffix is used for the persistent backup + # partition (000000000002) + BACKUP_PART_GUID="BA5EBA11-0000-1111-2222-000000000002" fi -case \${INSTDEV} in - *"nvme"*) - BACKUP_PART=\${INSTDEV}p\${BACKUP_PART_NO} - ;; - *) - BACKUP_PART=\${INSTDEV}\${BACKUP_PART_NO} - ;; -esac -BACKUP_PART_LABEL="platform_backup" - -DEFAULT_PERSISTENT_SIZE=30000 - -# Note that the BA5EBA11-0000-1111-2222- is the prefix used by STX and it's -# defined in sysinv constants.py. Since the 000000000001 suffix is used by -# custom stx LVM partitions, the next suffix is used for the persistent backup -# partition (000000000002) -BACKUP_PART_GUID="BA5EBA11-0000-1111-2222-000000000002" # Node Personality Trait TRAIT__CONTROLLER="controller" @@ -582,7 +633,6 @@ SUBFUNCTION__CONTROLLER="\${TRAIT__CONTROLLER}" SUBFUNCTION__STORAGE="\${TRAIT__STORAGE}" SUBFUNCTION__WORKER="\${TRAIT__WORKER}" SUBFUNCTION__AIO="\${TRAIT__CONTROLLER},\${TRAIT__WORKER}" -SUBFUNCTION__AIO_LOWLATENCY="\${TRAIT__CONTROLLER},\${TRAIT__WORKER},\${TRAIT__LOWLATENCY}" VOLUME_GROUPS="cgts-vg" ROOTFS_SIZE=\${RSZ} # 20000 @@ -591,6 +641,9 @@ EFI_SIZE=300 LOG_VOL_SIZE=8000 SCRATCH_VOL_SIZE=16000 EOF +############################### +# END of Common Functions Block +############################### chmod 755 /tmp/lat/ks_functions.sh HOOK_LABEL="ks-early" @@ -601,6 +654,7 @@ HOOK_LABEL="ks-early" ########################################################################## export debug=0 +export prefix="" export PLATFORM_BACKUP_SIZE=${DEFAULT_PERSISTENT_SIZE} @@ -623,22 +677,20 @@ ilog "***********************************************" ilog "** Pre Partition - Volume Remove & Wipe Disk **" ilog "***********************************************" +if [ -z "${traits}" ] ; then + report_failure_with_msg "No install traits specified ; need boot arg traits=" +fi + ilog "Waiting for disks to be available" udevadm settle --timeout=300 || report_failure_with_msg "udevadm settle failed" ilog "Disks became available" -# Default traits to AIO if missing -if [ -z "${traits}" ] ; then - traits="controller,worker" - wlog "traits option missing ; defaulting to ${traits}" -fi - export controller=false export storage=false export worker=false export lowlatency=false -export miniboot=false export aio=false + for trait in ${traits//,/ }; do # dlog "trait:${trait}" case ${trait} in @@ -646,13 +698,10 @@ for trait in ${traits//,/ }; do "storage") storage=true ;; "worker") worker=true ;; "lowlatency") lowlatency=true ;; - "miniboot") miniboot=true ;; *) wlog "unknown trait '${trait}'" ;; esac done -ilog "Install traits: $traits" - # Force enable 'lowlatency' trait if the realtime kernel is detected ; PREEMPT_RT uname=$(uname -a) if [[ "${uname}" == *"PREEMPT_RT"* ]] ; then @@ -662,7 +711,38 @@ if [[ "${uname}" == *"PREEMPT_RT"* ]] ; then fi fi -[ "${controller}" = true -a "${worker}" = true ] && aio=true +# Handle trait conbination errors +# +# Handle no valid nodetypes specified +if [ "${controller}" = false -a "${storage}" = false -a "${worker}" = false ] ; then + report_failure_with_msg "No valid install traits specified ; ${traits} ; need boot arg traits=" +# Storage and controller don't go together +elif [ "${storage}" = true -a "${controller}" = true ] ; then + report_failure_with_msg "Cannot combine storage and controller traits" +# Storage and lowlatency don't go together +elif [ "${storage}" = true -a "${lowlatency}" = true ] ; then + report_failure_with_msg "Cannot combine storage and lowlatency traits" +# Storage and worker don't go together +elif [ "${storage}" = true -a "${worker}" = true ] ; then + report_failure_with_msg "Cannot combine storage and worker traits" +else + ilog "Install traits: $traits" +fi + +# setup the install type for the log prefix +if [ "${controller}" = true -a "${worker}" = true ] ; then + aio=true + prefix="${SYSTEM_TYPE__AIO}" +elif [ "${controller}" = true ] ; then + prefix="${TRAIT__CONTROLLER}" +elif [ "${worker}" = true ] ; then + prefix="${TRAIT__WORKER}" +elif [ "${storage}" = true ] ; then + prefix="${TRAIT__STORAGE}" +fi +if [ "${lowlatency}" = true ] ; then + prefix="${prefix}-${TRAIT__LOWLATENCY}" +fi grep -q 'debug_kickstart' /proc/cmdline if [ $? -eq 0 ]; then @@ -710,11 +790,10 @@ function check_execs() [ "${storage}" = true ] && ilog "Storage Function" [ "${worker}" = true ] && ilog "Worker Function" [ "${lowlatency}" = true ] && ilog "Low Latency Function" -[ "${miniboot}" = true ] && ilog "Zero Touch Install Function" # Log System Type if [ ${aio} = true ] ; then - ilog "${SYSTEM_TYPE__AIO} system" + ilog "system" else ilog "${SYSTEM_TYPE__STANDARD} system" fi @@ -737,6 +816,39 @@ true HOOK_LABEL="pre-part" . /tmp/lat/ks_functions.sh + +##################################################### +# From pre_net_common.cfg for system node installs +##################################################### +if is_system_node_install -eq 0 ; then + + # Setup ntp.conf and sync time + cat </etc/ntp_kickstart.conf +server pxecontroller +EOF + + if [ -e /usr/sbin/ntpd ] ; then + /usr/sbin/ntpd -g -q -n -c /etc/ntp_kickstart.conf + rc=$? + if [ ${rc} -eq 0 ]; then + if [ -e /sbin/hwclock ] ; then + /sbin/hwclock --systohc --utc + if [ $? -ne 0 ]; then + wlog "failed hwclock command ; /sbin/hwclock --systohc --utc" + else + ilog "ntpd and hwclock set ok" + fi + else + wlog "lat initrd is missing /sbin/hwclock" + fi + else + wlog "ntpd setup failed rc:$rc ; /usr/sbin/ntpd -g -q -n -c /etc/ntp_kickstart.conf" + fi + else + wlog "lat initrd is missing /usr/sbin/ntpd" + fi +fi + ##################################################### # From pre_disk_setup_common.cfg ##################################################### @@ -823,7 +935,7 @@ if [ -z ${vgs} ] ; then else ilog "Found '${vgs}' volume groups" for vg in $vgs; do - wlog "... disabling $vg" + ilog "... disabling $vg" exec_no_fds "$STOR_DEV_FDS" "vgchange -an $vg 2>/dev/null" 5 0.5 [ $? -ne 0 ] && report_failure_with_msg "Failed to disable $vg." done @@ -835,12 +947,12 @@ else wlog "Found $vg with no PV on rootfs, ignoring." continue fi - wlog "Removing LVs on $vg." + ilog "Removing LVs on $vg." exec_no_fds "$STOR_DEV_FDS" "lvremove --force $vg" 5 0.5 || wlog "WARNING: Failed to remove lvs on $vg." pvs=$(exec_no_fds "$STOR_DEV_FDS" "pvs --select \"vg_name=$vg\" --noheadings -o pv_name") wlog "VG $vg has PVs: $(echo $pvs), removing them." for pv in $pvs; do - wlog "Removing PV $pv." + ilog "Removing PV $pv." exec_no_fds "$STOR_DEV_FDS" "pvremove --force --force --yes $pv" 5 0.5 [ $? -ne 0 ] && report_pre_failure_with_msg "ERROR: Failed to remove PV." done @@ -885,10 +997,10 @@ else # Check if we wipe OSDs if [ "$(curl -sf http://pxecontroller:6385/v1/ihosts/wipe_osds 2>/dev/null)" = "true" ]; then - wlog "Wipe OSD data" + ilog "Wipe OSD data" WIPE_CEPH_OSDS="true" else - wlog "Skip Ceph OSD data wipe." + ilog "Skip Ceph OSD data wipe." WIPE_CEPH_OSDS="false" fi @@ -1042,34 +1154,34 @@ do ;; esac - # ISSUE: ERIK: These are never the same when the by-path INSTDEV is used. - # dev = /dev/sda INSTDEV = by path string - ilog "Checking platform-backup partition ... $dev : ${INSTDEV} ${by_dev}" - sgdisk_part_info=$(sgdisk -i $part_number $dev) - part_type_guid=$(echo "$sgdisk_part_info" | grep "$part_type_guid_str" | awk '{print $4;}') - if [ "$dev" == "${by_dev}" -a "$part_type_guid" == $BACKUP_PART_GUID ] ; then - part_type_name=$(echo "$sgdisk_part_info" | grep "$part_type_name_str" | awk '{print $3,$4;}') - BACKUP_PART_NAME=${part_type_name:1:-1} + if [ "${controller}" = true ] ; then + ilog "Checking platform-backup partition ... $dev : ${INSTDEV} ${by_dev}" + sgdisk_part_info=$(sgdisk -i $part_number $dev) + part_type_guid=$(echo "$sgdisk_part_info" | grep "$part_type_guid_str" | awk '{print $4;}') + if [ "$dev" == "${by_dev}" -a "$part_type_guid" == $BACKUP_PART_GUID ] ; then + part_type_name=$(echo "$sgdisk_part_info" | grep "$part_type_name_str" | awk '{print $3,$4;}') + BACKUP_PART_NAME=${part_type_name:1:-1} - part_type_first=$(echo "$sgdisk_part_info" | grep "$part_type_first_str" | awk '{print $3;}') - BACKUP_PART_FIRST=${part_type_first} + part_type_first=$(echo "$sgdisk_part_info" | grep "$part_type_first_str" | awk '{print $3;}') + BACKUP_PART_FIRST=${part_type_first} - part_type_end=$(echo "$sgdisk_part_info" | grep "$part_type_end_str" | awk '{print $3;}') - BACKUP_PART_END=${part_type_end} + part_type_end=$(echo "$sgdisk_part_info" | grep "$part_type_end_str" | awk '{print $3;}') + BACKUP_PART_END=${part_type_end} - part_type_size=$(echo "$sgdisk_part_info" | grep "$part_type_size_str" | awk '{print $3;}') - BACKUP_PART_SIZE=${part_type_size} + part_type_size=$(echo "$sgdisk_part_info" | grep "$part_type_size_str" | awk '{print $3;}') + BACKUP_PART_SIZE=${part_type_size} - part_type_flags=$(echo "$sgdisk_part_info" | grep "$part_type_flags_str" | awk '{print $3;}') - BACKUP_PART_FLAGS=${part_type_flags} + part_type_flags=$(echo "$sgdisk_part_info" | grep "$part_type_flags_str" | awk '{print $3;}') + BACKUP_PART_FLAGS=${part_type_flags} - ilog "Platform Backup: ${BACKUP_PART_NAME}:${BACKUP_PART_FIRST}:${BACKUP_PART_END}:${BACKUP_PART_SIZE}:${part_type_guid}" + ilog "Platform Backup: ${BACKUP_PART_NAME}:${BACKUP_PART_FIRST}:${BACKUP_PART_END}:${BACKUP_PART_SIZE}:${part_type_guid}" - part_fstype=$(exec_retry 5 0.5 "blkid -s TYPE -o value $part") - if [ "${part_fstype}" == "ext4" ]; then - ilog "Skipping wipe of persistent partition $part" - BACKUP_CREATED=1 - continue + part_fstype=$(exec_retry 5 0.5 "blkid -s TYPE -o value $part") + if [ "${part_fstype}" == "ext4" ]; then + ilog "Skipping wipe of persistent partition $part" + BACKUP_CREATED=1 + continue + fi fi fi @@ -1103,7 +1215,7 @@ for dev in $STOR_DEVS; do fi done -wlog "Destroy otaroot partitions on root disk" +ilog "Destroy otaroot partitions on root disk" for oldrootlabel in otaroot otaroot_1 otaroot_b otaroot_b_1 do oldrootpart=$(blkid --label $oldrootlabel) @@ -1160,6 +1272,13 @@ esac # From pre_disk_controller.cfg ########################################################### +# Log the server firmware type +if [ -d /sys/firmware/efi ] ; then + ilog "UEFI Firmware" +else + ilog "BIOS Firmware" +fi + # Only controllers have a persistent partition # Allocate platform backup partition if [ "${controller}" = true ] ; then @@ -1179,12 +1298,6 @@ if [ "${controller}" = true ] ; then fi ilog "Platform Backup partition size: ${PLATFORM_BACKUP_SIZE}" - if [ -d /sys/firmware/efi ] ; then - ilog "UEFI Firmware" - else - ilog "BIOS Firmware" - fi - if [ ${BACKUP_CREATED} -eq 0 ] ; then ilog "Platform Backup partition not detected: CREATING" else @@ -1200,6 +1313,10 @@ if [ "${controller}" = true ] ; then grub_pt_update end=$(($first+($PLATFORM_BACKUP_SIZE*1024*1024/$lsz)-1)) a="$a -n $p:$first:$end -c $p:${BACKUP_PART_LABEL} -t $p:${BACKUP_PART_GUID}" + +elif [ ${worker} = true ] ; then + ilog "Setting up platform_pv partition sizes for worker node" + get_worker_provisioning_sizes fi # Allocate platform pv @@ -1207,7 +1324,7 @@ grub_pt_update if [ ${aio} = true ] ; then end=$(($first+(${MINIMUM_PLATFORM_PV_SIZE}*1024*1024/$lsz)-1)) else - ilog "Standard Controller: platform_pv partition - using all remaining disk space" + ilog "platform_pv partition - using all remaining disk space" end=$last fi a="$a -n $p:$first:$end -c $p:platform_pv -t $p:8E00" @@ -1240,6 +1357,10 @@ ilog "****************************************************" ilog "LAT size parameters: FSZ=${FSZ} BSZ=${BSZ} RSZ=${RSZ} VSZ=${VSZ} gb:${gb}" +vg="volume group" +lv="logical volume" +dev=$(get_disk "${INSTDEV}") + if [ "${controller}" = true ] ; then LOG_VOL_SIZE=8000 SCRATCH_VOL_SIZE=16000 @@ -1256,29 +1377,29 @@ if [ "${aio}" = true ] ; then get_aio_controller_provisioning_sizes elif [ "${controller}" = true ] ; then get_std_controller_provisioning_sizes +elif [ "${worker}" = true ] ; then + get_worker_provisioning_sizes fi ilog "MINIMUM_PLATFORM_PV_SIZE : ${MINIMUM_PLATFORM_PV_SIZE}" ilog "SCRATCH_VOL_SIZE : ${SCRATCH_VOL_SIZE}" ilog "ROOTFS_SIZE : ${ROOTFS_SIZE}" ilog "LOG_VOL_SIZE : ${LOG_VOL_SIZE}" -ilog "PLATFORM_BACKUP_SIZE : ${PLATFORM_BACKUP_SIZE}" -ilog "BACKUP_PART : ${BACKUP_PART}" -ilog "BACKUP_PART_NO : ${BACKUP_PART_NO}" -ilog "BACKUP_PART_LABEL : ${BACKUP_PART_LABEL}" -ilog "BACKUP_PART_GUID : ${BACKUP_PART_GUID}" +if [ "${controller}" = true ] ; then + ilog "PLATFORM_BACKUP_SIZE : ${PLATFORM_BACKUP_SIZE}" + ilog "BACKUP_PART : ${BACKUP_PART}" + ilog "BACKUP_PART_NO : ${BACKUP_PART_NO}" + ilog "BACKUP_PART_LABEL : ${BACKUP_PART_LABEL}" + ilog "BACKUP_PART_GUID : ${BACKUP_PART_GUID}" -vg="volume group" -lv="logical volume" -dev=$(get_disk "${INSTDEV}") - -# Only init Platform Backup partition filesystem if the partition was just created -pi=$((pi+1)) -if [ ${BACKUP_PERSISTED} -eq 0 ] ; then - ilog "Platform Backup Partition was CREATED. Initialize filesystem on ${BACKUP_PART}" - mkfs.ext4 -F -L ${BACKUP_PART_LABEL} ${BACKUP_PART} - [ ${?} -ne 0 ] && report_failure_with_msg "Failed Platform Backup partition filesystem init ${BACKUP_PART}" + # Only init Platform Backup partition filesystem if the partition was just created + pi=$((pi+1)) + if [ ${BACKUP_PERSISTED} -eq 0 ] ; then + ilog "Platform Backup Partition was CREATED. Initialize filesystem on ${BACKUP_PART}" + mkfs.ext4 -F -L ${BACKUP_PART_LABEL} ${BACKUP_PART} + [ ${?} -ne 0 ] && report_failure_with_msg "Failed Platform Backup partition filesystem init ${BACKUP_PART}" + fi fi # Log important LVM config settings @@ -1348,7 +1469,7 @@ log_lvm_conf ##################################################################### # Close all FDs and wait for udev to reshuffle all partitions. -wlog "Releasing storage device locks and FDs." +ilog "Releasing storage device locks and FDs." for fd in $STOR_DEV_FDS do flock -u "$fd" @@ -1374,21 +1495,6 @@ ilog "****************************************************" ilog "**** Post - Traits & Platform Config File update **" ilog "****************************************************" -set -- `env` -dlog "env: $*" - -if false ; then -# TODO: Why does LAT break into prompt when I do this -for e in $*; do - case "$e" in - *=*) - eval $e 2>/dev/null - log "env : $e" - ;; - esac -done -fi - # Set node traits' state [ "${controller}" = true ] && ilog "Controller Function" [ "${storage}" = true ] && ilog "Storage Function" @@ -1402,17 +1508,10 @@ fi # Set nodetype from traits if [ "${controller}" = true ] ; then nodetype=${TRAIT__CONTROLLER} - ilog "Controller Function" elif [ "${storage}" = true ] ; then nodetype=${TRAIT__STORAGE} - ilog "Storage Function" elif [ "${worker}" = true ] ; then nodetype=${TRAIT__WORKER} -else - elog "No personality traits specified ; defaulting to All-In-One" - controller=true - worker=true - nodetype=${TRAIT__CONTROLLER} fi ilog "nodetype=${nodetype}" @@ -1423,11 +1522,7 @@ system_type="" if [ "${aio}" = true ] ; then ilog "${SYSTEM_TYPE__AIO} System" system_type="${SYSTEM_TYPE__AIO}" - if [ "${lowlatency}" = true ] ; then - subfunction="${SUBFUNCTION__AIO_LOWLATENCY}" - else - subfunction="${SUBFUNCTION__AIO}" - fi + subfunction="${SUBFUNCTION__AIO}" else ilog "${SYSTEM_TYPE__STANDARD} System" system_type="${SYSTEM_TYPE__STANDARD}" @@ -1439,16 +1534,14 @@ else subfunction=${SUBFUNCTION__CONTROLLER} fi fi + +if [ "${lowlatency}" = true ] ; then + subfunction="${subfunction},${TRAIT__LOWLATENCY}" +fi + ilog "subfunction=${subfunction}" ilog "system_type=${system_type}" -# Create and Update /etc/platform/platform.conf -# --------------------------------------------- - -if [ -e "${PLATFORM_CONF}" ] ; then - wlog "removing temp platform.conf" -fi - ################################################################# # From post_platform_conf_controller.cfg # From post_platform_conf_aio.cfg @@ -1463,6 +1556,10 @@ subfunction=${subfunction} system_type=${system_type} EOF +############################################################## +# From post_pxeboot_controller +# From post_net_common.cfg +# ############################################################ # Set http port # Persist the default http port number to platform configuration. # This will get overwritten when by manifest during sw configuration phase. @@ -1477,7 +1574,6 @@ update_platform_conf "http_port=${http_port}" # From post_common.cfg (all hosts) ############################################################# -# Ensure quick command response (i.e. sudo) rm /etc/hostname # TODO: is this needed with LAT ?? @@ -1548,18 +1644,11 @@ do fi done -# TODO: Remove as it turns out that this is not added by kickstarts. -# Remove all reference to 'security_feature' above as well. -# -# add security_feature to platform.conf ; be sure not to add as empty. -# [ -z "${security_feature}" ] && security_feature=none -# update_platform_conf "security_feature=${security_feature}" - [ "${KERN_OPTS}" != "" ] && ilog "Learned kernel params: ${KERN_OPTS}" -if [ "${aio}" = true ] ; then +ilog "Adding kernel options" +if [ "${aio}" = true -o "${worker}" = true ] ; then - ilog "Adding ${SYSTEM_TYPE__AIO} kernel options" if [ -e /etc/init.d/cpumap_functions.sh ] ; then # Update grub with custom kernel bootargs @@ -1629,13 +1718,6 @@ if [ "${aio}" = true ] ; then add_kernel_option "intel_iommu=on" fi - # Add kernel option to disable biosdevname if enabled - # As this may already be in GRUB_CMDLINE_LINUX, only add if it is not already present - grep -q '^GRUB_CMDLINE_LINUX=.*biosdevname=0' /etc/default/grub - if [ $? -ne 0 ]; then - add_kernel_option "biosdevname=0" - fi - # Add kernel options to disable kvm-intel.eptad on Broadwell # Broadwell: Model: 79, Model name: Intel(R) Xeon(R) CPU E5-2699 v4 @ 2.20GHz if grep -q -E "^model\s+:\s+79$" /proc/cpuinfo @@ -1643,10 +1725,6 @@ if [ "${aio}" = true ] ; then add_kernel_option "kvm-intel.eptad=0" fi - # k8s updates: - #KERN_OPTS="${KERN_OPTS} cgroup_disable=memory" - add_kernel_option "user_namespace.enable=1" - # Add kernel option to avoid jiffies_lock contention on real-time kernel if [ "${lowlatency}" = true ] ; then add_kernel_option "skew_tick=1" @@ -1664,29 +1742,48 @@ elif [ "${controller}" = true ] ; then ## add_kernel_option "loop.max_part=15" - ## Add kernel options to ensure an selinux is disabled - add_kernel_option "selinux=0 enforcing=0" # Add kernel options to ensure NMI watchdog is enabled, if supported add_kernel_option "nmi_watchdog=panic,1 softlockup_panic=1" - # Add kernel option to panic on a softdog timeout - add_kernel_option "softdog.soft_panic=1" +elif [ "${storage}" = true ] ; then - # Add kernel option to disable biosdevname if enabled - # As this may already be in GRUB_CMDLINE_LINUX, only add if it is not already present - grep -q '^GRUB_CMDLINE_LINUX=.*biosdevname=0' /etc/default/grub - [ $? -ne 0 ] && add_kernel_option "biosdevname=0" + ilog "Adding ${TRAIT__STORAGE} function kernel options" - # k8s updates - add_kernel_option "user_namespace.enable=1" -else - wlog "TODO: system node install type kernel parameters, worker and storage" + ## Custom kernel options + add_kernel_option "intel_iommu=off usbcore.autosuspend=-1" + + # Add kernel options to ensure NMI watchdog is enabled, if supported + add_kernel_option "nmi_watchdog=panic,1 softlockup_panic=1" fi +######################################################################################### +# From post_kernel_aio_and_worker.cfg +# From post_kernel_controller.cfg +# From post_kernel_storage.cfg +######################################################################################### + +# Add kernel options to ensure an selinux is disabled for all node types +add_kernel_option "selinux=0 enforcing=0" + +# Add kernel option to panic on a softdog timeout +add_kernel_option "softdog.soft_panic=1" + # Make sure that we are using cgroups v1 add_kernel_option "systemd.unified_cgroup_hierarchy=0" +# k8s updates +add_kernel_option "user_namespace.enable=1" + +# Add kernel option to disable biosdevname if enabled +# As this may already be in GRUB_CMDLINE_LINUX, only add if it is not already present +grep -q '^GRUB_CMDLINE_LINUX=.*biosdevname=0' /etc/default/grub +if [ $? -ne 0 ]; then + add_kernel_option "biosdevname=0" +fi + +######################################################################################## + ilog "Adding these kernel params to disk boot: ${KERN_OPTS}" if [ -n "${KERN_OPTS}" ] ; then grep -q "^kernel_params=" /boot/efi/EFI/BOOT/boot.env @@ -1792,12 +1889,10 @@ if [ -n "$BOOTIF" ] ; then fi else elog "ERROR:POST: Unable to determine mgmt interface from BOOTIF=$BOOTIF." - # TODO: MAKE Default - Should not get here without BOOTIF set ; LAT guarantees that. - # report_failure_with_msg "Unable to determine mgmt interface from BOOTIF=$BOOTIF." + report_failure_with_msg "Unable to determine mgmt interface from BOOTIF=$BOOTIF." fi else - elog "ERROR:POST: BOOTIF is not set. Unable to determine mgmt interface." - # TODO: MAKE Default - Should not get here without BOOTIF set ; LAT guarantees that. + wlog "BOOTIF is not set. Unable to determine mgmt interface." fi if [ ! -e "/etc/network/interfaces" ] ; then @@ -1926,6 +2021,10 @@ else else # must be a worker or storage node install pushd /tmp > /dev/null + + # There is no feed function on non-controller nodes + # TODO: Prevent feed dir packaging on non-controller nodes + rm -rf ${IMAGE_ROOTFS}/var/www/pages/feed fi if [ ! -e ./install_uuid ] ; then wget ${NOVERIFYSSL_WGET_OPT} ${pxeurl}/install_uuid -o /${LAT_DIR}/wget_install_uuid.log @@ -2020,9 +2119,7 @@ if [ "${controller}" = true ] ; then fi # handle USB install - pxeurl=$(echo $insturl | sed -e s/ostree_repo//) - if [ "${pxeurl}" = "file://NOT_SET" ] ; then - + if is_usb_install -eq 0 ; then pushd ${feed}/pxeboot > /dev/null ilog "Copy bzImage, initrd and respective secure boot .sig files" ilog "... from /instboot/pxeboot to ${feed}/pxeboot and ${pxeboot}/rel-${sw_release}" @@ -2045,6 +2142,7 @@ if [ "${controller}" = true ] ; then # handle pxeboot install else + pxeurl=$(echo $insturl | sed -e s/ostree_repo//) ilog "Fetch bzImage and initrd files from ${pxeurl}/pxeboot to ${feed}/pxeboot and ${pxeboot}/rel-${sw_release}" pushd ${feed}/pxeboot > /dev/null for f in bzImage bzImage-rt bzImage-rt.sig bzImage.sig bzImage-std bzImage-std.sig initrd initrd.sig; do @@ -2162,11 +2260,6 @@ else umount "${IMAGE_ROOTFS}/${LOG_DIR}" fi -# uncomment the global_filter line in lvm.conf -#perl -0777 -i.bak -pe 's:(# This configuration option has an automatic default value\.\n)\t# global_filter:$1 global_filter:m' ${IMAGE_ROOTFS}/etc/lvm/lvm.conf -#perl -0777 -i -pe 's:(# Example\n)\t# preferred_names:$1 preferred_names:m' ${IMAGE_ROOTFS}/etc/lvm/lvm.conf -#sed -i "s#^\( *\)global_filter = \[.*#\1global_filter = [ \"a|${LV_ROOTDISK}|\", \"r|.*|\" ]#" ${IMAGE_ROOTFS}/etc/lvm/lvm.conf - true %end @@ -2182,11 +2275,18 @@ ilog "****************************************************" ilog "*** Post Nochroot - Set up /etc/fstab ***" ilog "****************************************************" -mkdir -p ${IMAGE_ROOTFS}/var/rootdirs/opt/platform-backup +if [ ${controller} = true ] ; then + mkdir -p ${IMAGE_ROOTFS}/var/rootdirs/opt/platform-backup + echo -e "LABEL=platform_backup\t/var/rootdirs/opt/platform-backup\text4\tdefaults\t1 2" >> ${IMAGE_ROOTFS}/etc/fstab +elif [ ${worker} = true ] ; then + mkdir -p ${IMAGE_ROOTFS}/var/rootdir/opt/platform + echo -e "controller-platform-nfs:/opt/platform\t/opt/platform\tnfs\ttimeo=30,udp,rsize=1024,wsize=1024,_netdev 0 0" >> ${IMAGE_ROOTFS}/etc/fstab +fi + mkdir -p ${IMAGE_ROOTFS}/var/rootdirs/scratch -mkdir -p ${IMAGE_ROOTFS}/var/log -echo -e "LABEL=platform_backup\t/var/rootdirs/opt/platform-backup\text4\tdefaults\t1 2" >> ${IMAGE_ROOTFS}/etc/fstab echo -e "/dev/mapper/cgts--vg-scratch--lv\t/var/rootdirs/scratch\text4\tdefaults\t1 2" >> ${IMAGE_ROOTFS}/etc/fstab + +mkdir -p ${IMAGE_ROOTFS}/var/log echo -e "/dev/mapper/cgts--vg-log--lv\t/var/log\text4\tdefaults\t1 2" >> ${IMAGE_ROOTFS}/etc/fstab # Create first_boot flag