miniboot: Use release-specific prestage data, handle subcloud downgrade
This commit handles the relocation of ostree_repo prestaging data from /opt/platform-backup to /opt/platform-backup/<release>. The miniboot.cfg kickstart now looks for prestaged data in the release-specific location. We also handle the backup partition name change across CentOS/Debian. In the case of a downgrade the CentOS miniboot kickstart code is updated to use the partition GUID rather than LABEL or PARTLABEL. The GUID is constant across all releases and is therefore a more reliable indicator of the backup partition. Tech debt: Fix the arbitrary wait sleep calls used when configuring VLAN addressing. Now uses the more efficient wait_for_interface approach for the VLAN links. Test Plan PASS: - Boot with prestaged data under /opt/platform-backup/<release>/ Ensure boot/install successfully uses prestaged data. - Boot into older release under prestaged /opt/platform-backup/21.12 - Test moving from 22.12 -> 21.12 and 21.12 -> 22.12 - Ensure backup partition is found using GUID approach. - Ensure boot/install successfully uses prestaged data. - Boot into both current and older release with no prestaged data - Test moving from 22.12 -> 21.12 and 21.12 -> 22.12 - Ensure boot/install is successful. - Boot subcloud with bootstrap_vlan, ensure that the wait_for_interface calls properly wait until the link is up. Story: 2010611 Task: 47943 Depends-On: https://review.opendev.org/c/starlingx/distcloud/+/880789 Change-Id: I381b60285e9bfc375f01f45b79174b71da7f0565 Signed-off-by: Kyle MacLeod <kyle.macleod@windriver.com>
This commit is contained in:
parent
5babe39c78
commit
018d06ccec
@ -58,8 +58,8 @@
|
||||
|
||||
SW_VERSION=xxxPLATFORM_RELEASExxx
|
||||
STAGING_DIR="platform-backup"
|
||||
BACKUP_PART_LABEL=Platform\\x20Backup
|
||||
BACKUP_DEVICE=/dev/disk/by-partlabel/${BACKUP_PART_LABEL}
|
||||
BACKUP_DEVICE=
|
||||
BACKUP_PART_GUID="BA5EBA11-0000-1111-2222-000000000002"
|
||||
BACKUP_MOUNT=/mnt/${STAGING_DIR}
|
||||
BOOTIMAGE_ISO=""
|
||||
|
||||
@ -76,8 +76,17 @@ iso_check=false
|
||||
iso_mount=false
|
||||
prestaging_files=false
|
||||
|
||||
# Search for a backup partition, using GUID (which appears lower case in the blkid output):
|
||||
while read -r device_path; do
|
||||
if [ "$(blkid -p "${device_path}" | grep -c -i "${BACKUP_PART_GUID}")" -gt 0 ]; then
|
||||
BACKUP_DEVICE=${device_path}
|
||||
wlog "Found backup device: ${BACKUP_DEVICE}"
|
||||
break
|
||||
fi
|
||||
done <<<"$(lsblk --noheadings --list --path --output NAME)"
|
||||
|
||||
# Look for and validate the local iso image
|
||||
if [ -e ${BACKUP_DEVICE} ]; then
|
||||
if [ -n "${BACKUP_DEVICE}" ] && [ -e "${BACKUP_DEVICE}" ]; then
|
||||
mkdir -p ${BACKUP_MOUNT}
|
||||
mount ${BACKUP_DEVICE} ${BACKUP_MOUNT} 2>/dev/null
|
||||
rc=$?
|
||||
@ -183,6 +192,7 @@ fi
|
||||
|
||||
# Make sure the prestage directory exists, as well as the required subdirectories.
|
||||
exists_prestage=false
|
||||
ilog "${KS} Checking prestaged content PRESTAGE_DIR: ${PRESTAGE_DIR}"
|
||||
if [ ! -e ${PRESTAGE_DIR} ] || [ ! -e ${PRESTAGE_DIR}/Packages ] || [ ! -e ${PRESTAGE_DIR}/repodata ]; then
|
||||
exists_prestage=false
|
||||
wlog "${KS} Prestaged content not present"
|
||||
|
@ -1582,13 +1582,10 @@ else
|
||||
fi
|
||||
ilog "ip ${BOOTPARAM_IP_VER} link set up dev ${mgmt_dev}"
|
||||
ip ${BOOTPARAM_IP_VER} link set up dev ${mgmt_dev}
|
||||
# TODO(kmacleod) change to wait_for_interface 60:
|
||||
sleep 15
|
||||
wait_for_interface ${mgmt_dev} 60
|
||||
ilog "ip ${BOOTPARAM_IP_VER} link set up dev ${mgmt_iface}"
|
||||
ip ${BOOTPARAM_IP_VER} link set up dev ${mgmt_iface}
|
||||
# TODO(kmacleod) change to wait_for_interface 60:
|
||||
ilog "Wait 10s to settle interface..."
|
||||
sleep 10
|
||||
wait_for_interface ${mgmt_iface} 60
|
||||
|
||||
if [ -z "${BOOTPARAM_GW}" ]; then
|
||||
# No gateway
|
||||
@ -2049,28 +2046,29 @@ else
|
||||
|
||||
backup_device=/dev/disk/by-partlabel/platform_backup
|
||||
backup_mount=/tmp/platform-backup
|
||||
backup_mount_release="${backup_mount}"/xxxPLATFORM_RELEASExxx
|
||||
|
||||
ilog "Temporary backup mount is ${backup_mount}"
|
||||
ilog "Temporary backup mount: ${backup_mount}, release: ${backup_mount_release}"
|
||||
mkdir -p "${backup_mount}"
|
||||
mount "${backup_device}" "${backup_mount}" 2>/dev/null
|
||||
|
||||
# If ostree_repo is found at the mounted backup directory,
|
||||
# then set the ostree url to its location.
|
||||
remote_insturl=
|
||||
if [ -e ${backup_mount}/ostree_repo ]; then
|
||||
if [ -e ${backup_mount_release}/ostree_repo ]; then
|
||||
local_repo_check_fail=
|
||||
# Calculate local checksum and compare
|
||||
checksum_file=${backup_mount}/.ostree_repo_checksum
|
||||
checksum_file=${backup_mount_release}/.ostree_repo_checksum
|
||||
if [ -f "${checksum_file}" ]; then
|
||||
checksum_from_file=$(cat "${checksum_file}")
|
||||
ilog "Verifying checksum for prestaged ${backup_mount}/ostree_repo"
|
||||
pushd ${backup_mount} > /dev/null
|
||||
ilog "Verifying checksum for prestaged ${backup_mount_release}/ostree_repo"
|
||||
pushd ${backup_mount_release} > /dev/null
|
||||
checksum=$(find ostree_repo -type f -exec md5sum {} + | LC_ALL=C sort | md5sum | awk '{ print $1; }')
|
||||
popd > /dev/null
|
||||
if [ "${checksum}" = "${checksum_from_file}" ]; then
|
||||
ilog "Verified ostree checksum: ${checksum}"
|
||||
else
|
||||
elog "ostree checksum failed on ${backup_mount}/ostree_repo"
|
||||
elog "ostree checksum failed on ${backup_mount_release}/ostree_repo"
|
||||
elog "Calulated checksum: ${checksum}"
|
||||
elog "File checksum: ${checksum_from_file}"
|
||||
local_repo_check_fail=true
|
||||
@ -2079,8 +2077,8 @@ else
|
||||
# No prestage checksum file is available. Use ostree fsck instead.
|
||||
# The only problem with this is the length of time required for fsck to complete.
|
||||
wlog "No ostree checksum file at ${checksum_file}. Performing ostree fsck instead."
|
||||
if ! ostree --repo="${backup_mount}/ostree_repo" fsck; then
|
||||
elog "ostree fsck failed on prestaged ${backup_mount}/ostree_repo: reverting to remote pull"
|
||||
if ! ostree --repo="${backup_mount_release}/ostree_repo" fsck; then
|
||||
elog "ostree fsck failed on prestaged ${backup_mount_release}/ostree_repo: reverting to remote pull"
|
||||
local_repo_check_fail=true
|
||||
fi
|
||||
fi
|
||||
@ -2088,13 +2086,13 @@ else
|
||||
# Preserve remote_insturl for use in 2nd ostree pull below
|
||||
remote_insturl=${insturl}
|
||||
|
||||
insturl="file:///${backup_mount}/ostree_repo"
|
||||
insturl="file:///${backup_mount_release}/ostree_repo"
|
||||
ilog "Setting insturl to ${insturl} to use prestaged ostree_repo"
|
||||
else
|
||||
# Remove the corrupted ostree_repo.
|
||||
# Avoid setting insturl which will revert to using a remote pull
|
||||
elog "ostree integrity check failed: removing prestaged ${backup_mount}/ostree_repo"
|
||||
rm -rf "${backup_mount}/ostree_repo"
|
||||
elog "ostree integrity check failed: removing prestaged ${backup_mount_release}/ostree_repo"
|
||||
rm -rf "${backup_mount_release}/ostree_repo"
|
||||
elog "ostree integrity check failed: reverting to remote pull"
|
||||
fi
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user