Debian KS: use INSTDEV instead of instdev

Both of instdev and INSTDEV are used to get the install device.
The instdev is the input from boot parameters, and INSTDEV is
actually used by lat installer. In most cases, they are the same,
but there are two exceptions:

1) instdev maybe one or more devices separated by a comma [1],
but INSTDEV is only one device

2) If instdev is invalid (such as installer ISO image) or timeout,
INSTDEV will be changed by prompt selection [2]

So use INSTDEV to instead of instdev

[1] https://github.com/Wind-River/meta-lat/blob/main/
recipes-sota/initrdscripts/files/init-ostree-install.sh#L31
[2] https://github.com/Wind-River/meta-lat/commit/
f7e9befa780eeb81f21e7cd9f19f6bd227bc4d23

Story: 2009964
Task: 45152

Test Plan:
PASS - Rebuild kickstart
PASS - Build ISO
PASS - BIOS Boot/Install ISO on Nuc5,Nuc7 and Dell9010

Depends-On: https://review.opendev.org/c/starlingx/integ/+/838688

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Change-Id: Id3a371acedac72d0c2e8731671d24cab5c743df9
This commit is contained in:
Hongxu Jia 2022-04-21 21:35:44 +08:00
parent 85a8a94422
commit f8072a43f6

View File

@ -49,7 +49,7 @@
#
# LAT disk install override debug tool interface.
#
# lat-disk --install-device=${instdev} \
# lat-disk --install-device=${INSTDEV} \
# --fat-size=${FSZ} \
# --boot-size=${BSZ} \
# --root-size=${RSZ} \
@ -478,7 +478,7 @@ function get_aio_controller_provisioning_sizes()
# MINIMUM_SMALL_DISK_SIZE
default_small_disk_size=240
minimum_small_disk_size=196
sz=\$(blockdev --getsize64 \${instdev})
sz=\$(blockdev --getsize64 \${INSTDEV})
ilog "install disk size:\$sz gb:\$gb"
# Round MINIMUM_PLATFORM_PV_SIZE to the closest upper value that can be divided by 1024.
@ -525,12 +525,12 @@ if [ "${INSTFLUX}" = 0 ] ; then
else
BACKUP_PART_NO=6 # in base_bullseye.yaml, instflux=1 or not set
fi
case \${instdev} in
case \${INSTDEV} in
*"nvme"*)
BACKUP_PART=\${instdev}p\${BACKUP_PART_NO}
BACKUP_PART=\${INSTDEV}p\${BACKUP_PART_NO}
;;
*)
BACKUP_PART=\${instdev}\${BACKUP_PART_NO}
BACKUP_PART=\${INSTDEV}\${BACKUP_PART_NO}
;;
esac
BACKUP_PART_LABEL="platform_backup"
@ -699,12 +699,12 @@ ilog "Waiting for disks to be available"
udevadm settle --timeout=300 || report_failure_with_msg "udevadm settle failed"
ilog "Disks became available"
if [ -n "$instdev" ] ; then
instdev_by_path=$(get_by_path $instdev)
if [ -n "$INSTDEV" ] ; then
instdev_by_path=$(get_by_path $INSTDEV)
if [ -z ${instdev_by_path} ] ; then
report_failure_with_msg "invalid install device ${instdev}"
report_failure_with_msg "invalid install device ${INSTDEV}"
else
ilog "Install device: ${instdev} : ${instdev_by_path}"
ilog "Install device: ${INSTDEV} : ${instdev_by_path}"
fi
fi
@ -762,9 +762,9 @@ display_mount_info
# Consider removing since LAT already handles this failure mode
# Ensure specified device is not a USB drive
udevadm info --query=property --name=${instdev} |grep -q '^ID_BUS=usb'
udevadm info --query=property --name=${INSTDEV} |grep -q '^ID_BUS=usb'
if [ $? -eq 0 ]; then
report_failure_with_msg "Specified installation ($instdev) device is a USB drive."
report_failure_with_msg "Specified installation ($INSTDEV) device is a USB drive."
fi
# Log the disk setup
@ -788,7 +788,7 @@ else
# Remove the volume groups that have physical volumes on the root disk
for vg in $(exec_no_fds "$STOR_DEV_FDS" "vgs --noheadings -o vg_name"); do
exec_no_fds "$STOR_DEV_FDS" "pvs --select \"vg_name=$vg\" --noheadings -o pv_name" | grep -q "${instdev}"
exec_no_fds "$STOR_DEV_FDS" "pvs --select \"vg_name=$vg\" --noheadings -o pv_name" | grep -q "${INSTDEV}"
if [ $? -ne 0 ]; then
wlog "Found $vg with no PV on rootfs, ignoring."
continue
@ -827,14 +827,14 @@ part_type_flags_str="Attribute flags"
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})"
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.
# Never put the LAT install disk '${INSTDEV}' in that list.
WIPE_HDD=""
# Partition type OSD has a unique globally identifier
@ -870,7 +870,7 @@ else
# Action: Find correct place to put partprobe
#
# Avoid wiping the install root disk
# [ ${dev} == ${instdev} ] && continue
# [ ${dev} == ${INSTDEV} ] && continue
# Avoid wiping USB drives
udevadm info --query=property --name=$dev |grep -q '^ID_BUS=usb' && continue
@ -929,11 +929,11 @@ fi
ilog "***************************************************"
ilog "WIPE DISKs: ${WIPE_HDD}"
ilog "***************************************************"
by_dev=${instdev}
# TODO: Avoid this loop if the instdev does not have by-path in its name
by_dev=${INSTDEV}
# TODO: Avoid this loop if the INSTDEV does not have by-path in its name
for f in /dev/disk/by-path/*; do
if [ "${f}" == "${instdev}" ] ; then
by_dev=$(get_disk "${instdev}")
if [ "${f}" == "${INSTDEV}" ] ; then
by_dev=$(get_disk "${INSTDEV}")
break
fi
done
@ -956,7 +956,7 @@ do
sgdisk_part_info=$(sgdisk -i $part_number $dev)
part_name=$(echo "$sgdisk_part_info" | grep "$part_type_name_str" | awk '{print $3;}')
# special handling for the install device '${instdev}'
# special handling for the install device '${INSTDEV}'
if [ "${dev}" == "${by_dev}" ] ; then
# Skip over the bios, efi and boot partitions that got us here.
@ -1000,9 +1000,9 @@ do
;;
esac
# ISSUE: ERIK: These are never the same when the by-path instdev is used.
# dev = /dev/sda instdev = by path string
ilog "Checking platform-backup partition ... $dev : ${instdev} ${by_dev}"
# ISSUE: ERIK: These are never the same when the by-path INSTDEV is used.
# dev = /dev/sda INSTDEV = by path string
ilog "Checking platform-backup partition ... $dev : ${INSTDEV} ${by_dev}"
sgdisk_part_info=$(sgdisk -i $part_number $dev)
part_type_guid=$(echo "$sgdisk_part_info" | grep "$part_type_guid_str" | awk '{print $4;}')
if [ "$dev" == "${by_dev}" -a "$part_type_guid" == $BACKUP_PART_GUID ] ; then
@ -1106,11 +1106,11 @@ ilog "Allocate host partitions (MB) first:$first"
## NOTE: updates to partition sizes need to be also reflected in
## _controller_filesystem_limits() in sysinv/api/controllers/v1/istorconfig.py
ROOTFS_PART_PREFIX=${instdev}
ROOTFS_PART_PREFIX=${INSTDEV}
#check if disk is nvme
case $instdev in
case $INSTDEV in
*"nvme"*)
ROOTFS_PART_PREFIX=${instdev}p
ROOTFS_PART_PREFIX=${INSTDEV}p
;;
esac
@ -1174,9 +1174,9 @@ STOR_DEVS=$(echo "$STOR_DEVS" | xargs -n 1 | sort -u | xargs)
[ -z "$STOR_DEVS" ] && report_failure_with_msg "No storage devices available."
ilog "STOR_DEV_FDS Updated ; $STOR_DEV_FDS"
# reset $dev to instdev as LAT installer will partition the disk corresponding
# reset $dev to INSTDEV as LAT installer will partition the disk corresponding
# to that variable
dev=$instdev
dev=$INSTDEV
dlog "Requesting ${dev} Partition Table: ${a}"
@ -1229,7 +1229,7 @@ ilog "BACKUP_PART_GUID : ${BACKUP_PART_GUID}"
vg="volume group"
lv="logical volume"
dev=$(get_disk "${instdev}")
dev=$(get_disk "${INSTDEV}")
# Only init Platform Backup partition filesystem if the partition was just created
pi=$((pi+1))
@ -1256,7 +1256,7 @@ esac
ilog "cgts--vg-log--lv size: ${LOG_VOL_SIZE} MB"
ilog "cgts--vg-scratch--lv : ${SCRATCH_VOL_SIZE} MB"
ilog "Install disk: ${instdev}"
ilog "Install disk: ${INSTDEV}"
ilog "Current disk: ${dev} ; current partition index:$pi"
ilog "Physical Volume: ${pv_part}"