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,59 +1407,26 @@ 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})"
else
# 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_JOURNAL_MPATH_GUID="45B0969E-8AE0-4982-BF9D-5A8D867AF560"
# Check if we wipe OSDs
if [ "$(curl -sf http://pxecontroller:6385/v1/ihosts/wipe_osds 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
ilog "Wipe OSD data"
WIPE_CEPH_OSDS="true"
else
else
ilog "Skip Ceph OSD data wipe."
WIPE_CEPH_OSDS="false"
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
for dev in $STOR_DEVS ; do
# Avoid wiping USB drives
udevadm info --query=property --name=$dev |grep -q '^ID_BUS=usb' && continue
@ -1507,9 +1472,7 @@ else
WIPE_HDD=$dev
fi
fi
done
ilog "Not in upgrade"
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,59 +1297,27 @@ 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})"
else
# 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_JOURNAL_MPATH_GUID="45B0969E-8AE0-4982-BF9D-5A8D867AF560"
# Check if we wipe OSDs
if [ "$(curl -sf http://pxecontroller:6385/v1/ihosts/wipe_osds 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
if [ -n "${wipe_osds}" ] && [ "${wipe_osds}" = 0 ]; then
ilog "Wipe OSD data"
WIPE_CEPH_OSDS="true"
else
else
ilog "Skip Ceph OSD data wipe."
WIPE_CEPH_OSDS="false"
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
for dev in $STOR_DEVS ; do
# Avoid wiping USB drives
udevadm info --query=property --name=$dev |grep -q '^ID_BUS=usb' && continue
@ -1398,9 +1363,7 @@ else
WIPE_HDD=$dev
fi
fi
done
ilog "Not in upgrade"
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.