diff --git a/kickstart/files/kickstart.cfg b/kickstart/files/kickstart.cfg index 998d4944..4adce07a 100644 --- a/kickstart/files/kickstart.cfg +++ b/kickstart/files/kickstart.cfg @@ -1,5 +1,5 @@ # -# Copyright (c) 2022-2024 Wind River Systems, Inc. +# Copyright (c) 2022-2025 Wind River Systems, Inc. # SPDX-License-Identifier: Apache-2.0 # ############################################################################ @@ -1400,8 +1400,6 @@ fi display_volume_info "after" display_mount_info -ONLYUSE_HDD="" - part_type_guid_str="Partition GUID code" part_type_name_str="Partition name" part_type_size_str="Partition size" @@ -1409,107 +1407,72 @@ part_type_first_str="First sector" part_type_end_str="Last sector" part_type_flags_str="Attribute flags" -# The /v1/upgrade/${hostname}/in_upgrade endpoint accepts any textual data -# as hostname and returns system-wide upgrade state -hostname="hostname" +# Make a list of all the hard drives that are to be wiped. +# Never put the LAT install disk '${INSTDEV}' in that list. +WIPE_HDD="" +# Partition type OSD has a unique globally identifier +CEPH_OSD_GUID="4FBD7E29-9D25-41B8-AFD0-062C0CEFF05D" +CEPH_OSD_MPATH_GUID="4FBD7E29-8AE0-4982-BF9D-5A8D867AF560" +CEPH_JOURNAL_GUID="45B0969E-9B03-4F30-B4C6-B4B80CEFF106" +CEPH_MPATH_JOURNAL_GUID="45B0969E-8AE0-4982-BF9D-5A8D867AF560" -if [ "$(curl -sf http://pxecontroller:6385/v1/upgrade/${hostname}/in_upgrade 2>/dev/null)" = "true" ] ; then - - # In an upgrade, only wipe the disk with the rootfs and boot partition - wlog "In upgrade, wiping only ${INSTDEV}" - WIPE_HDD=${INSTDEV} - ONLYUSE_HDD="$(basename ${INSTDEV})" - +# Check if we wipe OSDs +if [ "$(curl -sf http://pxecontroller:6385/v1/ihosts/wipe_osds 2>/dev/null)" = "true" ] ; then + ilog "Wipe OSD data" + WIPE_CEPH_OSDS="true" else + ilog "Skip Ceph OSD data wipe." + WIPE_CEPH_OSDS="false" +fi - # Make a list of all the hard drives that are to be wiped. - # Never put the LAT install disk '${INSTDEV}' in that list. - WIPE_HDD="" +for dev in $STOR_DEVS ; do - # Partition type OSD has a unique globally identifier - CEPH_OSD_GUID="4FBD7E29-9D25-41B8-AFD0-062C0CEFF05D" - CEPH_OSD_MPATH_GUID="4FBD7E29-8AE0-4982-BF9D-5A8D867AF560" - CEPH_JOURNAL_GUID="45B0969E-9B03-4F30-B4C6-B4B80CEFF106" - CEPH_JOURNAL_MPATH_GUID="45B0969E-8AE0-4982-BF9D-5A8D867AF560" + # Avoid wiping USB drives + udevadm info --query=property --name=$dev |grep -q '^ID_BUS=usb' && continue - # Check if we wipe OSDs - if [ "$(curl -sf http://pxecontroller:6385/v1/ihosts/wipe_osds 2>/dev/null)" = "true" ] ; then - ilog "Wipe OSD data" - WIPE_CEPH_OSDS="true" - else - ilog "Skip Ceph OSD data wipe." - WIPE_CEPH_OSDS="false" + # Avoid wiping ceph osds if sysinv tells us so + if [ ${WIPE_CEPH_OSDS} == "false" ] ; then + wipe_dev="true" + + # Check if the disk is Rook Ceph OSD + fs_type=$(blkid -o value -s TYPE "${dev}") + if [ "${fs_type}" == "ceph_bluestore" ]; then + wlog "BlueStore OSD found on $dev, skipping wipe" + wipe_dev="false" + else + part_numbers=( `parted -s $dev print | awk '$1 == "Number" {i=1; next}; i {print $1}'` ) + # Scanning the partitions looking for CEPH OSDs and + # skipping any disk found with such partitions + for part_number in "${part_numbers[@]}" ; do + sgdisk_part_info=$(sgdisk -i $part_number $dev) + part_type_guid=$(echo "$sgdisk_part_info" | grep "$part_type_guid_str" | awk '{print $4;}') + if [ "$part_type_guid" == $CEPH_OSD_GUID -o "$part_type_guid" == $CEPH_OSD_MPATH_GUID ]; then + wlog "OSD found on $dev, skipping wipe" + wipe_dev="false" + break + fi + done + fi + + if [ "$wipe_dev" == "false" ] ; then + continue + fi fi - for dev in $STOR_DEVS ; do - # TODO: Allowing the install dev 'in' results in a failure mode where - # every second install fails with the following error string - # and unrecoverable mount failure. - # - # Logs: - # - # Warning: The kernel is still using the old partition table. - # The new table will be used at the next reboot or after you - # run partprobe(8) or kpartx(8) - # and then - # - # Failure: - # - # mount: /sysroot: can't find LABEL=otaroot. - # - # Action: Find correct place to put partprobe - # - # Avoid wiping the install root disk - # [ ${dev} == ${INSTDEV} ] && continue - - # Avoid wiping USB drives - udevadm info --query=property --name=$dev |grep -q '^ID_BUS=usb' && continue - - # Avoid wiping ceph osds if sysinv tells us so - if [ ${WIPE_CEPH_OSDS} == "false" ] ; then - wipe_dev="true" - - # Check if the disk is Rook Ceph OSD - fs_type=$(blkid -o value -s TYPE "${dev}") - if [ "${fs_type}" == "ceph_bluestore" ]; then - wlog "BlueStore OSD found on $dev, skipping wipe" - wipe_dev="false" - else - part_numbers=( `parted -s $dev print | awk '$1 == "Number" {i=1; next}; i {print $1}'` ) - # Scanning the partitions looking for CEPH OSDs and - # skipping any disk found with such partitions - for part_number in "${part_numbers[@]}" ; do - sgdisk_part_info=$(sgdisk -i $part_number $dev) - part_type_guid=$(echo "$sgdisk_part_info" | grep "$part_type_guid_str" | awk '{print $4;}') - if [ "$part_type_guid" == $CEPH_OSD_GUID -o "$part_type_guid" == $CEPH_OSD_MPATH_GUID ]; then - wlog "OSD found on $dev, skipping wipe" - wipe_dev="false" - break - fi - done - fi - - if [ "$wipe_dev" == "false" ] ; then - continue - fi + # Add device to the wipe list + devname=$(basename $dev) + if [ -e $dev -a "$ISO_DEV" != "../../$devname" -a "$USB_DEV" != "../../$devname" ] ; then + ilog "Adding ${dev} to list of disks to be wiped" + if [ -n "$WIPE_HDD" ] ; then + ilog "WIPE_HDD=$WIPE_HDD,$dev" + WIPE_HDD=$WIPE_HDD,$dev + else + ilog "WIPE_HDD=$dev" + WIPE_HDD=$dev fi - - # Add device to the wipe list - devname=$(basename $dev) - if [ -e $dev -a "$ISO_DEV" != "../../$devname" -a "$USB_DEV" != "../../$devname" ] ; then - ilog "Adding ${dev} to list of disks to be wiped" - if [ -n "$WIPE_HDD" ] ; then - ilog "WIPE_HDD=$WIPE_HDD,$dev" - WIPE_HDD=$WIPE_HDD,$dev - else - ilog "WIPE_HDD=$dev" - WIPE_HDD=$dev - fi - fi - done - ilog "Not in upgrade" -fi + fi +done ilog "===========" ilog "WIPE DISKs: ${WIPE_HDD}" @@ -3475,3 +3438,5 @@ true # Warning: Do not remove the line feed from the end of this file # or the install will fail with a permission denied error. %end + +# vim: filetype=sh diff --git a/kickstart/files/miniboot.cfg b/kickstart/files/miniboot.cfg index 57ccf12e..9c3afb18 100644 --- a/kickstart/files/miniboot.cfg +++ b/kickstart/files/miniboot.cfg @@ -1,5 +1,5 @@ # -# Copyright (c) 2022-2024 Wind River Systems, Inc. +# Copyright (c) 2022-2025 Wind River Systems, Inc. # SPDX-License-Identifier: Apache-2.0 # ############################################################################ @@ -992,7 +992,6 @@ fi set -- `cat /proc/cmdline` ilog "/proc/cmdline:$*" -# for I in $*; do case "$I" in *=*) eval $I 2>/dev/null;; esac; done for arg in $*; do case "$arg" in *=*) @@ -1291,8 +1290,6 @@ fi display_volume_info "after" display_mount_info -ONLYUSE_HDD="" - part_type_guid_str="Partition GUID code" part_type_name_str="Partition name" part_type_size_str="Partition size" @@ -1300,107 +1297,73 @@ part_type_first_str="First sector" part_type_end_str="Last sector" part_type_flags_str="Attribute flags" -# The /v1/upgrade/${hostname}/in_upgrade endpoint accepts any textual data -# as hostname and returns system-wide upgrade state -hostname="hostname" +# Make a list of all the hard drives that are to be wiped. +# Never put the LAT install disk '${INSTDEV}' in that list. +WIPE_HDD="" +# Partition type OSD has a unique globally identifier +CEPH_OSD_GUID="4FBD7E29-9D25-41B8-AFD0-062C0CEFF05D" +CEPH_OSD_MPATH_GUID="4FBD7E29-8AE0-4982-BF9D-5A8D867AF560" +CEPH_JOURNAL_GUID="45B0969E-9B03-4F30-B4C6-B4B80CEFF106" +CEPH_MPATH_JOURNAL_GUID="45B0969E-8AE0-4982-BF9D-5A8D867AF560" -if [ "$(curl -sf http://pxecontroller:6385/v1/upgrade/${hostname}/in_upgrade 2>/dev/null)" = "true" ]; then - - # In an upgrade, only wipe the disk with the rootfs and boot partition - wlog "In upgrade, wiping only ${INSTDEV}" - WIPE_HDD=${INSTDEV} - ONLYUSE_HDD="$(basename ${INSTDEV})" - +# Check if we wipe OSDs (Note: default is to wipe. We only skip the wipe if explicitly turned off) +# 'wipe_osds' can be passed in as a kernel argument if required +if [ -n "${wipe_osds}" ] && [ "${wipe_osds}" = 0 ]; then + ilog "Wipe OSD data" + WIPE_CEPH_OSDS="true" else + ilog "Skip Ceph OSD data wipe." + WIPE_CEPH_OSDS="false" +fi - # Make a list of all the hard drives that are to be wiped. - # Never put the LAT install disk '${INSTDEV}' in that list. - WIPE_HDD="" +for dev in $STOR_DEVS ; do - # Partition type OSD has a unique globally identifier - CEPH_OSD_GUID="4FBD7E29-9D25-41B8-AFD0-062C0CEFF05D" - CEPH_OSD_MPATH_GUID="4FBD7E29-8AE0-4982-BF9D-5A8D867AF560" - CEPH_JOURNAL_GUID="45B0969E-9B03-4F30-B4C6-B4B80CEFF106" - CEPH_JOURNAL_MPATH_GUID="45B0969E-8AE0-4982-BF9D-5A8D867AF560" + # Avoid wiping USB drives + udevadm info --query=property --name=$dev |grep -q '^ID_BUS=usb' && continue - # Check if we wipe OSDs - if [ "$(curl -sf http://pxecontroller:6385/v1/ihosts/wipe_osds 2>/dev/null)" = "true" ]; then - ilog "Wipe OSD data" - WIPE_CEPH_OSDS="true" - else - ilog "Skip Ceph OSD data wipe." - WIPE_CEPH_OSDS="false" + # Avoid wiping ceph osds if sysinv tells us so + if [ ${WIPE_CEPH_OSDS} == "false" ]; then + wipe_dev="true" + + # Check if the disk is Rook Ceph OSD + fs_type=$(blkid -o value -s TYPE "${dev}") + if [ "${fs_type}" == "ceph_bluestore" ]; then + wlog "BlueStore OSD found on $dev, skipping wipe" + wipe_dev="false" + else + part_numbers=( `parted -s $dev print | awk '$1 == "Number" {i=1; next}; i {print $1}'` ) + # Scanning the partitions looking for CEPH OSDs and + # skipping any disk found with such partitions + for part_number in "${part_numbers[@]}"; do + sgdisk_part_info=$(sgdisk -i $part_number $dev) + part_type_guid=$(echo "$sgdisk_part_info" | grep "$part_type_guid_str" | awk '{print $4;}') + if [ "$part_type_guid" == $CEPH_OSD_GUID -o "$part_type_guid" == $CEPH_OSD_MPATH_GUID ]; then + wlog "OSD found on $dev, skipping wipe" + wipe_dev="false" + break + fi + done + fi + + if [ "$wipe_dev" == "false" ]; then + continue + fi fi - for dev in $STOR_DEVS ; do - # TODO: Allowing the install dev 'in' results in a failure mode where - # every second install fails with the following error string - # and unrecoverable mount failure. - # - # Logs: - # - # Warning: The kernel is still using the old partition table. - # The new table will be used at the next reboot or after you - # run partprobe(8) or kpartx(8) - # and then - # - # Failure: - # - # mount: /sysroot: can't find LABEL=otaroot. - # - # Action: Find correct place to put partprobe - # - # Avoid wiping the install root disk - # [ ${dev} == ${INSTDEV} ] && continue - - # Avoid wiping USB drives - udevadm info --query=property --name=$dev |grep -q '^ID_BUS=usb' && continue - - # Avoid wiping ceph osds if sysinv tells us so - if [ ${WIPE_CEPH_OSDS} == "false" ]; then - wipe_dev="true" - - # Check if the disk is Rook Ceph OSD - fs_type=$(blkid -o value -s TYPE "${dev}") - if [ "${fs_type}" == "ceph_bluestore" ]; then - wlog "BlueStore OSD found on $dev, skipping wipe" - wipe_dev="false" - else - part_numbers=( `parted -s $dev print | awk '$1 == "Number" {i=1; next}; i {print $1}'` ) - # Scanning the partitions looking for CEPH OSDs and - # skipping any disk found with such partitions - for part_number in "${part_numbers[@]}"; do - sgdisk_part_info=$(sgdisk -i $part_number $dev) - part_type_guid=$(echo "$sgdisk_part_info" | grep "$part_type_guid_str" | awk '{print $4;}') - if [ "$part_type_guid" == $CEPH_OSD_GUID -o "$part_type_guid" == $CEPH_OSD_MPATH_GUID ]; then - wlog "OSD found on $dev, skipping wipe" - wipe_dev="false" - break - fi - done - fi - - if [ "$wipe_dev" == "false" ]; then - continue - fi + # Add device to the wipe list + devname=$(basename $dev) + if [ -e $dev -a "$ISO_DEV" != "../../$devname" -a "$USB_DEV" != "../../$devname" ]; then + ilog "Adding ${dev} to list of disks to be wiped" + if [ -n "$WIPE_HDD" ]; then + ilog "WIPE_HDD=$WIPE_HDD,$dev" + WIPE_HDD=$WIPE_HDD,$dev + else + ilog "WIPE_HDD=$dev" + WIPE_HDD=$dev fi - - # Add device to the wipe list - devname=$(basename $dev) - if [ -e $dev -a "$ISO_DEV" != "../../$devname" -a "$USB_DEV" != "../../$devname" ]; then - ilog "Adding ${dev} to list of disks to be wiped" - if [ -n "$WIPE_HDD" ]; then - ilog "WIPE_HDD=$WIPE_HDD,$dev" - WIPE_HDD=$WIPE_HDD,$dev - else - ilog "WIPE_HDD=$dev" - WIPE_HDD=$dev - fi - fi - done - ilog "Not in upgrade" -fi + fi +done ilog "===========" ilog "WIPE DISKs: ${WIPE_HDD}" @@ -2211,24 +2174,23 @@ else fi fi - # Tell LAT to install from this local stage - # i.e. override where LAT installs from. + # Tell LAT to install from this local stage i.e. override where LAT installs from. export instl=${repo} export INSTL=${instl} ostree --repo=${repo} init --mode=archive if [ "${insturl}" = "file://NOT_SET" ] ; then - ilog "ostree_repo archive pull from file:///instboot/ostree_repo" + ilog "ostree --repo=${repo}: pulling from file:///instboot/ostree_repo" ostree --repo=${repo} remote add ${instbr} file:///instboot/ostree_repo else - ilog "ostree_repo archive pull from ${insturl}" + ilog "ostree --repo=${repo}: pulling from ${insturl}" ostree --repo=${repo} remote add ${instbr} ${insturl} fi # Check for noverifyssl in boot arguments. # Note: even if noverifyssl is not set, we still don't have proper support # for SSL certificates (which would require configuring cert paths here). if grep -q noverifyssl /proc/cmdline 2>/dev/null; then - ilog "Configuring ostree for unverified SSL" + ilog "Configuring ostree --repo=${repo} for unverified SSL" ostree config --repo=${repo} set "remote \"${instbr}\"".tls-permissive true fi # Check for instgpg=0 in boot arguments.