Remove upgrade checks in kickstarts

We no longer check for upgrade state during kickstart execution. Moving
forward (beginning this release), upgrades are done via USM, and no
longer involve installation. Therefore there is no longer a need to
check and act on upgrade states during installation.

The upgrade checks are removed, simplifying the code flow in both the
main and miniboot kickstarts.

For remote operation against a subcloud, a kernel argument is added:
'wipe_osds' (default value is true). If false, this will cause the OSDs
to be preserved over install - this is currently used in the restore
use-case, and is controlled by dcmanager.

Test Plan
PASS : install system controller in libvirt (controller-0)
PASS: install inactive controller-1 via pxeboot
PASS: Verify that OSD disk wiping happens when the wipe_osds parameter
      is queried from pxecontroller address

For subcloud:
PASS: Install subcloud via sushy
PASS: Install subcloud via sushy, pass in wipe_osds flag. Ensure OSDs
      are wiped.
PASS: Verify that OSD disk wiping is triggered during subcloud
      remote-install when "wipe_osds: True" is included in
      the install_values.
PASS: Verify that OSD disk wiping is skipped during subcloud
      remote-install when "wipe_osds" is removed from
      the install_values.
PASS: Verify that OSD disk wiping is skipped during a backup
      restore, regardless of whether "wipe_osds" exists in
      the data_install (this is via the wipe_osds flag).

Closes-Bug: 2091589

Co-authored-by: Kyle MacLeod <kyle.macleod@windriver.com>
Change-Id: Ic68c70fa084cfc3331bc7b05f5dbbf4b3b084a30
Signed-off-by: lzhu1 <li.zhu@windriver.com>
This commit is contained in:
Li Zhu 2024-12-11 20:53:05 -05:00 committed by Kyle MacLeod
parent 28ca6049a4
commit a0f8eb3fc4
2 changed files with 123 additions and 196 deletions

View File

@ -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 # SPDX-License-Identifier: Apache-2.0
# #
############################################################################ ############################################################################
@ -1400,8 +1400,6 @@ fi
display_volume_info "after" display_volume_info "after"
display_mount_info display_mount_info
ONLYUSE_HDD=""
part_type_guid_str="Partition GUID code" part_type_guid_str="Partition GUID code"
part_type_name_str="Partition name" part_type_name_str="Partition name"
part_type_size_str="Partition size" part_type_size_str="Partition size"
@ -1409,107 +1407,72 @@ part_type_first_str="First sector"
part_type_end_str="Last sector" part_type_end_str="Last sector"
part_type_flags_str="Attribute flags" part_type_flags_str="Attribute flags"
# The /v1/upgrade/${hostname}/in_upgrade endpoint accepts any textual data # Make a list of all the hard drives that are to be wiped.
# as hostname and returns system-wide upgrade state # Never put the LAT install disk '${INSTDEV}' in that list.
hostname="hostname" 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 # Check if we wipe OSDs
if [ "$(curl -sf http://pxecontroller:6385/v1/ihosts/wipe_osds 2>/dev/null)" = "true" ] ; then
# In an upgrade, only wipe the disk with the rootfs and boot partition ilog "Wipe OSD data"
wlog "In upgrade, wiping only ${INSTDEV}" WIPE_CEPH_OSDS="true"
WIPE_HDD=${INSTDEV}
ONLYUSE_HDD="$(basename ${INSTDEV})"
else 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. for dev in $STOR_DEVS ; do
# Never put the LAT install disk '${INSTDEV}' in that list.
WIPE_HDD=""
# Partition type OSD has a unique globally identifier # Avoid wiping USB drives
CEPH_OSD_GUID="4FBD7E29-9D25-41B8-AFD0-062C0CEFF05D" udevadm info --query=property --name=$dev |grep -q '^ID_BUS=usb' && continue
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"
# Check if we wipe OSDs # Avoid wiping ceph osds if sysinv tells us so
if [ "$(curl -sf http://pxecontroller:6385/v1/ihosts/wipe_osds 2>/dev/null)" = "true" ] ; then if [ ${WIPE_CEPH_OSDS} == "false" ] ; then
ilog "Wipe OSD data" wipe_dev="true"
WIPE_CEPH_OSDS="true"
else # Check if the disk is Rook Ceph OSD
ilog "Skip Ceph OSD data wipe." fs_type=$(blkid -o value -s TYPE "${dev}")
WIPE_CEPH_OSDS="false" 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 fi
for dev in $STOR_DEVS ; do # Add device to the wipe list
# TODO: Allowing the install dev 'in' results in a failure mode where devname=$(basename $dev)
# every second install fails with the following error string if [ -e $dev -a "$ISO_DEV" != "../../$devname" -a "$USB_DEV" != "../../$devname" ] ; then
# and unrecoverable mount failure. ilog "Adding ${dev} to list of disks to be wiped"
# if [ -n "$WIPE_HDD" ] ; then
# Logs: ilog "WIPE_HDD=$WIPE_HDD,$dev"
# WIPE_HDD=$WIPE_HDD,$dev
# Warning: The kernel is still using the old partition table. else
# The new table will be used at the next reboot or after you ilog "WIPE_HDD=$dev"
# run partprobe(8) or kpartx(8) WIPE_HDD=$dev
# 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
fi fi
fi
# Add device to the wipe list done
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
ilog "===========" ilog "==========="
ilog "WIPE DISKs: ${WIPE_HDD}" ilog "WIPE DISKs: ${WIPE_HDD}"
@ -3475,3 +3438,5 @@ true
# Warning: Do not remove the line feed from the end of this file # Warning: Do not remove the line feed from the end of this file
# or the install will fail with a permission denied error. # or the install will fail with a permission denied error.
%end %end
# vim: filetype=sh

View File

@ -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 # SPDX-License-Identifier: Apache-2.0
# #
############################################################################ ############################################################################
@ -992,7 +992,6 @@ fi
set -- `cat /proc/cmdline` set -- `cat /proc/cmdline`
ilog "/proc/cmdline:$*" ilog "/proc/cmdline:$*"
# for I in $*; do case "$I" in *=*) eval $I 2>/dev/null;; esac; done
for arg in $*; do for arg in $*; do
case "$arg" in case "$arg" in
*=*) *=*)
@ -1291,8 +1290,6 @@ fi
display_volume_info "after" display_volume_info "after"
display_mount_info display_mount_info
ONLYUSE_HDD=""
part_type_guid_str="Partition GUID code" part_type_guid_str="Partition GUID code"
part_type_name_str="Partition name" part_type_name_str="Partition name"
part_type_size_str="Partition size" part_type_size_str="Partition size"
@ -1300,107 +1297,73 @@ part_type_first_str="First sector"
part_type_end_str="Last sector" part_type_end_str="Last sector"
part_type_flags_str="Attribute flags" part_type_flags_str="Attribute flags"
# The /v1/upgrade/${hostname}/in_upgrade endpoint accepts any textual data # Make a list of all the hard drives that are to be wiped.
# as hostname and returns system-wide upgrade state # Never put the LAT install disk '${INSTDEV}' in that list.
hostname="hostname" 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 # 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
# In an upgrade, only wipe the disk with the rootfs and boot partition if [ -n "${wipe_osds}" ] && [ "${wipe_osds}" = 0 ]; then
wlog "In upgrade, wiping only ${INSTDEV}" ilog "Wipe OSD data"
WIPE_HDD=${INSTDEV} WIPE_CEPH_OSDS="true"
ONLYUSE_HDD="$(basename ${INSTDEV})"
else 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. for dev in $STOR_DEVS ; do
# Never put the LAT install disk '${INSTDEV}' in that list.
WIPE_HDD=""
# Partition type OSD has a unique globally identifier # Avoid wiping USB drives
CEPH_OSD_GUID="4FBD7E29-9D25-41B8-AFD0-062C0CEFF05D" udevadm info --query=property --name=$dev |grep -q '^ID_BUS=usb' && continue
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"
# Check if we wipe OSDs # Avoid wiping ceph osds if sysinv tells us so
if [ "$(curl -sf http://pxecontroller:6385/v1/ihosts/wipe_osds 2>/dev/null)" = "true" ]; then if [ ${WIPE_CEPH_OSDS} == "false" ]; then
ilog "Wipe OSD data" wipe_dev="true"
WIPE_CEPH_OSDS="true"
else # Check if the disk is Rook Ceph OSD
ilog "Skip Ceph OSD data wipe." fs_type=$(blkid -o value -s TYPE "${dev}")
WIPE_CEPH_OSDS="false" 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 fi
for dev in $STOR_DEVS ; do # Add device to the wipe list
# TODO: Allowing the install dev 'in' results in a failure mode where devname=$(basename $dev)
# every second install fails with the following error string if [ -e $dev -a "$ISO_DEV" != "../../$devname" -a "$USB_DEV" != "../../$devname" ]; then
# and unrecoverable mount failure. ilog "Adding ${dev} to list of disks to be wiped"
# if [ -n "$WIPE_HDD" ]; then
# Logs: ilog "WIPE_HDD=$WIPE_HDD,$dev"
# WIPE_HDD=$WIPE_HDD,$dev
# Warning: The kernel is still using the old partition table. else
# The new table will be used at the next reboot or after you ilog "WIPE_HDD=$dev"
# run partprobe(8) or kpartx(8) WIPE_HDD=$dev
# 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
fi fi
fi
# Add device to the wipe list done
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
ilog "===========" ilog "==========="
ilog "WIPE DISKs: ${WIPE_HDD}" ilog "WIPE DISKs: ${WIPE_HDD}"
@ -2211,24 +2174,23 @@ else
fi fi
fi fi
# Tell LAT to install from this local stage # Tell LAT to install from this local stage i.e. override where LAT installs from.
# i.e. override where LAT installs from.
export instl=${repo} export instl=${repo}
export INSTL=${instl} export INSTL=${instl}
ostree --repo=${repo} init --mode=archive ostree --repo=${repo} init --mode=archive
if [ "${insturl}" = "file://NOT_SET" ] ; then 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 ostree --repo=${repo} remote add ${instbr} file:///instboot/ostree_repo
else else
ilog "ostree_repo archive pull from ${insturl}" ilog "ostree --repo=${repo}: pulling from ${insturl}"
ostree --repo=${repo} remote add ${instbr} ${insturl} ostree --repo=${repo} remote add ${instbr} ${insturl}
fi fi
# Check for noverifyssl in boot arguments. # Check for noverifyssl in boot arguments.
# Note: even if noverifyssl is not set, we still don't have proper support # Note: even if noverifyssl is not set, we still don't have proper support
# for SSL certificates (which would require configuring cert paths here). # for SSL certificates (which would require configuring cert paths here).
if grep -q noverifyssl /proc/cmdline 2>/dev/null; then 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 ostree config --repo=${repo} set "remote \"${instbr}\"".tls-permissive true
fi fi
# Check for instgpg=0 in boot arguments. # Check for instgpg=0 in boot arguments.