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
#
############################################################################
@ -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

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
#
############################################################################
@ -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.