Support CentOS previous release in subcloud remote install

This commit introduces support for installing CentOS-based previous
release (21.12) in Debian.

There are two main components in this commit:
1. Handle the label change for the backup partition:

Platform Backup in 21.12 vs 'platform_backup' in Debian
This is accomplished by ignoring the label/partlabel entirely when
searching for an existing backup partition. Instead, the partition
GUID is used to locate the partition. The GUID does not change
between distributions.

2. Use pre-bundled CentOS kickstarts for subcloud installs in Debian

Since modifications are required to the CentOS kickstart files for the
above, we copy the relevant pre-bundled centos kickstarts (for miniboot
and prestaged ISO only) into a centos-specific directory under the
Debian /var/www/pages/feed/rel-${platform_release}/kickstart directory
structure, in order to be available for the gen-bootloader-iso-centos.sh
utility. These files are included in the platform-kickstarts .deb
package.

NOTES on how the pre-bundled files are created:
- We cannot use the files under bsp-file/kickstarts/*.cfg, since they
  are not valid for 21.12 release (e.g. they refer to /var/www)
- Instead, files were taken from a valid 21.12 release and manually
  merged with the pre-bundled files generated from this repo

GOING FORWARD:
Only the bundled files at kickstart/files/centos/*.cfg will be
maintained. At a later time, we may choose to remove the partial
kickstarts under bsp-files/kickstarts/*.cfg, since they are not used
anywhere.

Test Plan

PASS:
- Build full ISO, verify that the
  /var/www/pages/feed/rel-23.09/kickstart/centos directory is populated
  with the pre-bundled kickstart files
- Verify previous-release CentOS subcloud install/deployment under
  Debian (requires patched 22.12 load)
- Verify current-release subcloud install under Debian

Story: 2010611
Task: 48268

Signed-off-by: Kyle MacLeod <kyle.macleod@windriver.com>
Change-Id: I1b7f76212e222dea7c6e586e4e9492f8a86a955e
This commit is contained in:
Kyle MacLeod 2023-06-20 17:42:25 -04:00
parent 0510b0c1a7
commit 5f3c54297d
9 changed files with 7387 additions and 58 deletions

View File

@ -178,12 +178,13 @@ if [ -n "${BACKUP_DEVICE}" ] && [ -e "${BACKUP_DEVICE}" ]; then
wlog "${KS} ${BACKUP_MOUNT} not mounted" wlog "${KS} ${BACKUP_MOUNT} not mounted"
fi fi
else else
wlog "${KS} mount of ${BACKUP_DEVICE} to ${BACKUP_MOUNT} failed rc:$rc" wlog "${KS} mount of '${BACKUP_DEVICE}' to ${BACKUP_MOUNT} failed rc:$rc"
fi fi
else else
wlog "${KS} backup device ${BACKUP_DEVICE} does not exist" wlog "${KS} backup device '${BACKUP_DEVICE}' does not exist"
fi fi
wlog "${KS} iso_check: ${iso_check} iso_mount: ${iso_mount}"
if [ "${iso_check}" = true -a "${iso_mount}" = true ] ; then if [ "${iso_check}" = true -a "${iso_mount}" = true ] ; then
wlog "${KS} Local Install ready" wlog "${KS} Local Install ready"
elif [ "${iso_mount}" = false ] ; then elif [ "${iso_mount}" = false ] ; then
@ -192,7 +193,7 @@ fi
# Make sure the prestage directory exists, as well as the required subdirectories. # Make sure the prestage directory exists, as well as the required subdirectories.
exists_prestage=false exists_prestage=false
ilog "${KS} Checking prestaged content PRESTAGE_DIR: ${PRESTAGE_DIR}" wlog "${KS} Checking prestaged content PRESTAGE_DIR: ${PRESTAGE_DIR}"
if [ ! -e ${PRESTAGE_DIR} ] || [ ! -e ${PRESTAGE_DIR}/Packages ] || [ ! -e ${PRESTAGE_DIR}/repodata ]; then if [ ! -e ${PRESTAGE_DIR} ] || [ ! -e ${PRESTAGE_DIR}/Packages ] || [ ! -e ${PRESTAGE_DIR}/repodata ]; then
exists_prestage=false exists_prestage=false
wlog "${KS} Prestaged content not present" wlog "${KS} Prestaged content not present"
@ -229,15 +230,15 @@ fi
# If this fails, they are fetched from the System Controller - Remote Install # If this fails, they are fetched from the System Controller - Remote Install
# #
if [ "${exists_prestage}" = true ]; then if [ "${exists_prestage}" = true ]; then
wlog "${KS} Prestage directory found: ${PRESTAGE_DIR}" wlog "${KS} Prestage directory found: ${PRESTAGE_DIR}. Proceeding with prestaged install."
cat << EOF > /tmp/repo-include cat << EOF > /tmp/repo-include
repo --name=local-base --cost=100 --baseurl=file://${PRESTAGE_DIR}/ repo --name=local-base --cost=100 --baseurl=file://${PRESTAGE_DIR}/
repo --name=local-updates --cost=100 --baseurl=file://${PRESTAGE_DIR}/patches/ repo --name=local-updates --cost=100 --baseurl=file://${PRESTAGE_DIR}/patches/
repo --name=remote-base --cost=200 --baseurl=xxxHTTP_URLxxx/ repo --name=remote-base --cost=200 --baseurl=xxxHTTP_URLxxx/
repo --name=remote-updates --cost=200 --baseurl=xxxHTTP_URLxxx/patches/ repo --name=remote-updates --cost=200 --baseurl=xxxHTTP_URLxxx/patches/
EOF EOF
elif [ "${iso_check}" = true -a "${iso_mount}" = true ] ; then elif [ "${iso_check}" = true ] && [ "${iso_mount}" = true ] ; then
wlog "${KS} Packages will be retrieved from prestage iso" wlog "${KS} Packages will be retrieved from prestage ISO. Proceeding with local (ISO) install."
cat << EOF > /tmp/repo-include cat << EOF > /tmp/repo-include
repo --name=local-base --cost=100 --baseurl=file://${BOOTIMAGE_MOUNT}/ repo --name=local-base --cost=100 --baseurl=file://${BOOTIMAGE_MOUNT}/
repo --name=local-updates --cost=100 --baseurl=file://${BOOTIMAGE_MOUNT}/patches/ repo --name=local-updates --cost=100 --baseurl=file://${BOOTIMAGE_MOUNT}/patches/
@ -246,7 +247,7 @@ elif [ "${iso_check}" = true -a "${iso_mount}" = true ] ; then
EOF EOF
else else
# Mirror remote software repositories # Mirror remote software repositories
wlog "${KS} Staging Repo" wlog "${KS} Staging Repo via ${feed_url}"
# Check for inst.noverifyssl # Check for inst.noverifyssl
if grep -q inst.noverifyssl /proc/cmdline; then if grep -q inst.noverifyssl /proc/cmdline; then
@ -317,6 +318,7 @@ else
repo --name=remote-updates --cost=200 --baseurl=xxxHTTP_URLxxx/patches/ repo --name=remote-updates --cost=200 --baseurl=xxxHTTP_URLxxx/patches/
EOF EOF
fi fi
wlog "Using repo config:\n$(cat /tmp/repo-include)"
%end %end
# Repository arguments from %pre # Repository arguments from %pre

View File

@ -15,11 +15,11 @@ KS="Prestaging post:"
# much in-service controller function setup stuff. # much in-service controller function setup stuff.
# #
# Therefore, it is added here to ensure that if the prestaging # Therefore, it is added here to ensure that if the prestaging
# ISO's pre_disk_aio.cfg 'created' the 'Platform Backup' # ISO's pre_disk_aio.cfg 'created' the 'Platform Backup/platform_backup'
# partition then it will get labeled for prestaging group. # partition then it will get labeled for prestaging group.
# #
# This prestaging kickstart file uses the 'label' to find the # This prestaging kickstart file uses the GUID to find the
# 'Platform Backup' partition for its prestaging function. # platform backup partition for its prestaging function.
# #
change_guid=/tmp/backup-guid-change.sh change_guid=/tmp/backup-guid-change.sh
if [ -f "$change_guid" ]; then if [ -f "$change_guid" ]; then
@ -50,8 +50,8 @@ wlog "${KS} install source : $SOURCE_DIR"
export SW_VERSION=xxxPLATFORM_RELEASExxx export SW_VERSION=xxxPLATFORM_RELEASExxx
export STAGING_DIR="platform-backup" export STAGING_DIR="platform-backup"
export PRESTAGING_PART_LABEL=Platform\\x20Backup export BACKUP_PART_GUID="BA5EBA11-0000-1111-2222-000000000002"
export PRESTAGING_DEVICE=/dev/disk/by-partlabel/${PRESTAGING_PART_LABEL} export BACKUP_DEVICE=
export PRESTAGING_REPO_DIR="${SOURCE_DIR}/opt/${STAGING_DIR}" export PRESTAGING_REPO_DIR="${SOURCE_DIR}/opt/${STAGING_DIR}"
export PRESTAGING_LOCAL_DIR="/mnt/${STAGING_DIR}" export PRESTAGING_LOCAL_DIR="/mnt/${STAGING_DIR}"
@ -75,59 +75,54 @@ elif [ ! -d "${PRESTAGING_REPO_DIR}/${SW_VERSION}" ] ; then
report_prestaging_failure_with_msg "${msg}" report_prestaging_failure_with_msg "${msg}"
fi fi
# Poll for the Platform Backup partition label. # Poll for the platform backup GUID
# TODO: Turn this into a function.
found=false
for i in {1..6} ; do for i in {1..6} ; do
# Search for a backup partition, using GUID (which appears lower case in the blkid output):
files=$(ls /dev/disk/by-partlabel) while read -r device_path; do
for file in $files ; do if [ "$(blkid -p "${device_path}" | grep -c -i "${BACKUP_PART_GUID}")" -gt 0 ]; then
if [ "$file" == "Platform\x20Backup" ] ; then BACKUP_DEVICE=${device_path}
if [ ${i} -gt 1 ] ; then wlog "Found backup device: ${BACKUP_DEVICE}"
wlog "${KS} prestaging partition label found in ${i} audit"
fi
found=true
break break
fi fi
done done <<<"$(lsblk --noheadings --list --path --output NAME)"
if [ "$found" = true ] ; then if [ -n "${BACKUP_DEVICE}" ] ; then
break break
else else
wlog "${KS} searching for 'Platform\x20Backup' label ${i}" wlog "${KS} searching for backup partition ${BACKUP_PART_GUID} GUID [${i}/6]"
sleep 10 sleep 10
fi fi
done done
# if the label is not visable yet then we will see it in a mount failure if [ -z "${BACKUP_DEVICE}" ]; then
if [ ! -d "${PRESTAGING_LOCAL_DIR}" ] ; then msg="Could not find backup device from GUID ${BACKUP_PART_GUID}"
wlog "${KS} mounting ${PRESTAGING_LOCAL_DIR}"
mkdir -p ${PRESTAGING_LOCAL_DIR}
mount ${PRESTAGING_DEVICE} ${PRESTAGING_LOCAL_DIR}
rc=$?
if [ $rc -eq 0 ] ; then
sleep 2
if [ ! -d "${PRESTAGING_LOCAL_DIR}" ] ; then
wlog "${KS} mount of staging '${PRESTAGING_LOCAL_DIR}' does not exist"
error=true
else
error=false
fi
else
wlog "${KS} mount of '${PRESTAGING_DEVICE}' to '${PRESTAGING_LOCAL_DIR}' failed rc:${rc}"
error=true
fi
fi
if [ "$error" = true ] ; then
msg="Unable to mount ${PRESTAGING_LOCAL_DIR}"
wlog "${KS} Prestaging failed: ${msg}" wlog "${KS} Prestaging failed: ${msg}"
report_prestaging_failure_with_msg "${msg}" report_prestaging_failure_with_msg "${msg}"
fi fi
errmsg=
if [ ! -d "${PRESTAGING_LOCAL_DIR}" ] ; then
wlog "${KS} mounting ${PRESTAGING_LOCAL_DIR}"
mkdir -p "${PRESTAGING_LOCAL_DIR}"
mount "${BACKUP_DEVICE}" "${PRESTAGING_LOCAL_DIR}"
rc=$?
if [ $rc -eq 0 ] ; then
sleep 2
if [ ! -d "${PRESTAGING_LOCAL_DIR}" ] ; then
errmsg="${KS} mount of staging '${PRESTAGING_LOCAL_DIR}' does not exist"
fi
else
errmsg="${KS} mount of '${BACKUP_DEVICE}' to '${PRESTAGING_LOCAL_DIR}' failed rc:${rc}"
fi
fi
if [ -n "$errmsg" ] ; then
wlog "${KS} Prestaging failed: ${errmsg}"
report_prestaging_failure_with_msg "${errmsg}"
fi
# nuke local prestaging dir - cleanup operation # nuke local prestaging dir - cleanup operation
if [ -d ${PRESTAGING_LOCAL_DIR}/${SW_VERSION} ] ; then if [ -d ${PRESTAGING_LOCAL_DIR}/${SW_VERSION} ] ; then
wlog "${KS} wiping prestaging dir '${PRESTAGING_LOCAL_DIR}/${SW_VERSION}'" wlog "${KS} cleanup; wiping existing prestaging dir '${PRESTAGING_LOCAL_DIR}/${SW_VERSION}'"
rm -rf ${PRESTAGING_LOCAL_DIR}/${SW_VERSION} rm -rf ${PRESTAGING_LOCAL_DIR}/${SW_VERSION}
fi fi
@ -138,8 +133,14 @@ mkdir ${PRESTAGING_LOCAL_DIR}/${SW_VERSION}
cd ${PRESTAGING_LOCAL_DIR}/${SW_VERSION} cd ${PRESTAGING_LOCAL_DIR}/${SW_VERSION}
# copy repo prestaging files to the local mount # copy repo prestaging files to the local mount
wlog "${KS} copy prestaging files" wlog "${KS} copy prestaging files: from '${PRESTAGING_REPO_DIR}/${SW_VERSION}' to '${PRESTAGING_LOCAL_DIR}'"
cp -a ${PRESTAGING_REPO_DIR}/${SW_VERSION} ${PRESTAGING_LOCAL_DIR} cp -a "${PRESTAGING_REPO_DIR}/${SW_VERSION}" "${PRESTAGING_LOCAL_DIR}/"
rc=$?
if [ $rc -ne 0 ] ; then
msg="copy failed from '${PRESTAGING_REPO_DIR}/${SW_VERSION}' to '${PRESTAGING_LOCAL_DIR}/', rc=${rc}"
wlog "${KS} Prestaging Failed: ${msg}"
report_prestaging_failure_with_msg "${msg}"
fi
wlog "${KS} prestaging files copy done" wlog "${KS} prestaging files copy done"
# loop over all the prestaged files # loop over all the prestaged files

View File

@ -258,6 +258,7 @@ do
# GPT partitions, they save partition info at the start and the end of the block. # GPT partitions, they save partition info at the start and the end of the block.
# Do this for each partition on the disk, as well. # Do this for each partition on the disk, as well.
part_numbers=( $(parted -s $dev print | awk '$1 == "Number" {i=1; next}; i {print $1}') ) part_numbers=( $(parted -s $dev print | awk '$1 == "Number" {i=1; next}; i {print $1}') )
wlog "WIPE_HDD: checking dev: $dev, part_numbers: $part_numbers, rootfs_device: $rootfs_device, boot_device: $boot_device"
for part_number in "${part_numbers[@]}"; do for part_number in "${part_numbers[@]}"; do
part=$dev$part_number part=$dev$part_number
case $part in case $part in
@ -267,13 +268,16 @@ do
esac esac
sgdisk_part_info=$(sgdisk -i $part_number $dev) sgdisk_part_info=$(sgdisk -i $part_number $dev)
part_type_guid=$(echo "$sgdisk_part_info" | grep "$part_type_guid_str" | awk '{print $4;}') part_type_guid=$(echo "$sgdisk_part_info" | grep "$part_type_guid_str" | awk '{print $4;}')
if [ "$dev" == "$rootfs_device" ]; then if [ "$dev" = "$rootfs_device" ] || [ "$dev" = "$boot_device" ]; then
wlog "Checking for backup partition: $part"
part_fstype=$(exec_retry 5 0.5 "blkid -s TYPE -o value $part") part_fstype=$(exec_retry 5 0.5 "blkid -s TYPE -o value $part")
if [ "$part_type_guid" == $BACKUP_PART_GUID -a "${part_fstype}" == "ext4" ]; then if [ "$part_type_guid" = "$BACKUP_PART_GUID" ] && [ "${part_fstype}" = "ext4" ]; then
wlog "Skipping wipe backup partition $part" wlog "Skipping wipe backup partition $part"
BACKUP_CREATED=1 BACKUP_CREATED=1
continue continue
fi else
wlog "Skipping part:$part_number $dev GUID: $part_type_guid"
fi
fi fi
wlog "Wiping partition $part" wlog "Wiping partition $part"
if [[ $WIPE_CEPH_OSDS == "true" && ( "$part_type_guid" == $CEPH_REGULAR_JOURNAL_GUID || "$part_type_guid" == $CEPH_MPATH_JOURNAL_GUID ) ]]; then if [[ $WIPE_CEPH_OSDS == "true" && ( "$part_type_guid" == $CEPH_REGULAR_JOURNAL_GUID || "$part_type_guid" == $CEPH_MPATH_JOURNAL_GUID ) ]]; then

View File

@ -82,17 +82,17 @@ fi
# it tries to reconfigure the partition in a later step. We delete the partition now so that # it tries to reconfigure the partition in a later step. We delete the partition now so that
# parted succeeds in the later step. # parted succeeds in the later step.
partition_id=$(parted -s ${rootfs_device} print | awk '/Platform Backup/ { print $1; }') # The backup partition may be labeled 'Platform Backup' (centos) or 'platform_backup' (debian)
partition_id=$(parted -s ${rootfs_device} print | awk '/(Platform Backup|platform_backup)/ { print $1; }')
# if the partition id is not empty or zero, then the partition actually exists. # If the partition id is not empty or zero, then the partition actually exists.
# Delete the partition. # Delete the partition.
if [[ "${partition_id}" -ne '' && "${partition_id}" -ne "0" ]]; then if [ -n "${partition_id}" ] && [ "${partition_id}" -ne 0 ]; then
wlog "Deleting platform backup at partition ${partition_id} on ${rootfs_device}" wlog "Deleting platform backup at partition ${partition_id} on ${rootfs_device}"
# Delete the platform backup partition # Delete the platform backup partition
parted -s ${rootfs_device} rm ${partition_id} parted -s ${rootfs_device} rm ${partition_id}
rc=$? rc=$?
if [ "${rc}" -ne "0" ]; then if [ "${rc}" -ne "0" ]; then
wlog "Unable to delete platform backup at partition ${partition_id} on ${rootfs_device}: [exit code ${rc}]" wlog "Unable to delete platform backup at partition ${partition_id} on ${rootfs_device}: [exit code ${rc}]"
exit -1 exit -1

View File

@ -14,6 +14,11 @@ override_dh_auto_configure:
override_dh_install: override_dh_install:
install -d -m 755 $(ROOT)/var/www/pages/feed/rel-${platform_release}/kickstart install -d -m 755 $(ROOT)/var/www/pages/feed/rel-${platform_release}/kickstart
install -d -m 755 $(ROOT)/var/www/pages/feed/rel-${platform_release}/kickstart/centos
install -p -D -m 700 kickstart.cfg $(ROOT)/var/www/pages/feed/rel-${platform_release}/kickstart install -p -D -m 700 kickstart.cfg $(ROOT)/var/www/pages/feed/rel-${platform_release}/kickstart
install -p -D -m 700 miniboot.cfg $(ROOT)/var/www/pages/feed/rel-${platform_release}/kickstart install -p -D -m 700 miniboot.cfg $(ROOT)/var/www/pages/feed/rel-${platform_release}/kickstart
install -p -D -m 700 centos/miniboot_controller_ks.cfg $(ROOT)/var/www/pages/feed/rel-${platform_release}/kickstart/centos
install -p -D -m 700 centos/miniboot_smallsystem_ks.cfg $(ROOT)/var/www/pages/feed/rel-${platform_release}/kickstart/centos
install -p -D -m 700 centos/miniboot_smallsystem_lowlatency_ks.cfg $(ROOT)/var/www/pages/feed/rel-${platform_release}/kickstart/centos
install -p -D -m 700 centos/prestaged_installer_ks.cfg $(ROOT)/var/www/pages/feed/rel-${platform_release}/kickstart/centos
dh_install dh_install

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff