Port kickstart mpath support to Debian
Several changes were added on CentOS for multipath support, mainly, the following commits were added: https://review.opendev.org/c/starlingx/metal/+/837016 https://review.opendev.org/c/starlingx/metal/+/842413 This change port the scope of those changes in the Debian kickstart mimic mechanism. <Add steps required for testing> <Add test with TrueNAS> Test Plan TBD Depends-On: https://review.opendev.org/c/starlingx/tools/+/860590 Co-Authored-By: Matheus Guilhermino <matheus.machadoguilhermino@windriver.com> Signed-off-by: Adriano Oliveira <adriano.oliveira@windriver.com> Change-Id: I8b7ab349d9991810d4faad9c3f7e3be625d6ed5c
This commit is contained in:
parent
f644aa29b0
commit
00c9a4dba0
|
@ -160,6 +160,11 @@ function report_failure_with_msg()
|
|||
#########################################################################
|
||||
function get_disk()
|
||||
{
|
||||
if echo \$1 | grep -q mpath; then
|
||||
find -L /dev/mapper/ -samefile \$1
|
||||
return
|
||||
fi
|
||||
|
||||
echo "\$(cd /dev ; readlink -f \$1)"
|
||||
}
|
||||
|
||||
|
@ -176,6 +181,14 @@ function get_disk()
|
|||
#########################################################################
|
||||
function get_by_path()
|
||||
{
|
||||
local dev_name=\$(basename \$1)
|
||||
for p in /dev/mapper/mpath*; do
|
||||
if [ "\$p" = "\$1" -o "\$p" = "/dev/mapper/\$dev_name" ]; then
|
||||
find -L /dev/disk/by-id/dm-uuid* -samefile /dev/mapper/\$dev_name
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
# log "Function: get_by_path '\${1}'"
|
||||
local disk=\$(cd /dev ; readlink -f \$1)
|
||||
reverse_list=""
|
||||
|
@ -203,6 +216,7 @@ function get_disk_dev()
|
|||
if [ -d /sys/block/\$blk_dev ]; then
|
||||
disk=\$(ls -l /sys/block/\$blk_dev | grep -v usb | head -n1 | sed 's/^.*\([vsdh]d[a-z]\+\).*\$/\1/');
|
||||
if [ -n "\$disk" ]; then
|
||||
exec_retry 3 0.5 "multipath -c /dev/\$disk" > /dev/null && continue
|
||||
echo "\$disk"
|
||||
return
|
||||
fi
|
||||
|
@ -217,6 +231,12 @@ function get_disk_dev()
|
|||
fi
|
||||
fi
|
||||
done
|
||||
for mpath_dev in mpatha mpathb; do
|
||||
if [ -e /dev/mapper/\$mpath_dev ]; then
|
||||
echo "/dev/mapper/\$mpath_dev"
|
||||
return
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
#########################################################################
|
||||
|
@ -937,6 +957,7 @@ check_execs
|
|||
# TODO: The installer does not have 'timezone'
|
||||
# Does LAT handle this ?
|
||||
wlog "timezone not set ; 'timezone --nontp --utc UTC'"
|
||||
breakpoint
|
||||
true
|
||||
%end
|
||||
|
||||
|
@ -1133,11 +1154,23 @@ for f in /dev/disk/by-path/*; do
|
|||
dev=$(readlink -f $f)
|
||||
# dlog "found device ${f}"
|
||||
exec_retry 2 0.5 "lsblk --nodeps --pairs $dev" | grep -q 'TYPE="disk"'
|
||||
if [ $? -eq 0 ] ; then
|
||||
# Filter out ISO disk from storage devices
|
||||
check_valid_dev $dev || continue
|
||||
STOR_DEVS="$STOR_DEVS $dev"
|
||||
ilog "Adding ${f} -> ${dev} to managed device list"
|
||||
if [ $? -eq 0 ]; then
|
||||
exec_retry 3 0.5 "multipath -c $dev" > /dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
mpath_dev=/dev/mapper/$(exec_retry 3 0.5 "multipath -l $dev" | head -n1 | cut -d " " -f 1)
|
||||
if echo $STOR_DEVS | grep -q -w $mpath_dev; then
|
||||
continue
|
||||
else
|
||||
STOR_DEVS="$STOR_DEVS $mpath_dev"
|
||||
mpath_path=$(find -L /dev/disk/by-id/dm-uuid* -samefile $mpath_dev)
|
||||
ilog "Adding ${mpath_path}->${mpath_dev} to managed device list"
|
||||
fi
|
||||
else
|
||||
# Filter out ISO disk from storage devices
|
||||
check_valid_dev $dev || continue
|
||||
STOR_DEVS="$STOR_DEVS $dev"
|
||||
ilog "Adding ${f} -> ${dev} to managed device list"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
|
@ -1251,8 +1284,10 @@ else
|
|||
WIPE_HDD=""
|
||||
|
||||
# Partition type OSD has a unique globally identifier
|
||||
CEPH_OSD_GUID="4FBD7E29-9D25-41B8-AFD0-062C0CEFF05D"
|
||||
CEPH_JOURNAL_GUID="45B0969E-9B03-4F30-B4C6-B4B80CEFF106"
|
||||
CEPH_REGULAR_OSD_GUID="4FBD7E29-9D25-41B8-AFD0-062C0CEFF05D"
|
||||
CEPH_REGULAR_JOURNAL_GUID="45B0969E-9B03-4F30-B4C6-B4B80CEFF106"
|
||||
CEPH_MPATH_OSD_GUID="4FBD7E29-8AE0-4982-BF9D-5A8D867AF560"
|
||||
CEPH_MPATH_JOURNAL_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
|
||||
|
@ -1304,7 +1339,7 @@ else
|
|||
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 ]; then
|
||||
if [ "$part_type_guid" == $CEPH_REGULAR_OSD_GUID -o "$part_type_guid" == $CEPH_MPATH_OSD_GUID ]; then
|
||||
wlog "OSD found on $dev, skipping wipe"
|
||||
wipe_dev="false"
|
||||
break
|
||||
|
@ -1467,7 +1502,7 @@ do
|
|||
fi
|
||||
fi
|
||||
|
||||
if [ $WIPE_CEPH_OSDS == "true" -a "$part_type_guid" == $CEPH_JOURNAL_GUID ]; then
|
||||
if [[ $WIPE_CEPH_OSDS == "true" && ( "$part_type_guid" == $CEPH_REGULAR_JOURNAL_GUID || "$part_type_guid" == $CEPH_MPATH_JOURNAL_GUID ) ]]; then
|
||||
# Journal partitions require additional wiping. Based on the ceph-manage-journal.py
|
||||
# script in the integ repo (at the ceph/ceph/files/ceph-manage-journal.py location)
|
||||
# wiping 100MB of data at the beginning of the partition should be enough. We also
|
||||
|
|
|
@ -1103,8 +1103,10 @@ else
|
|||
WIPE_HDD=""
|
||||
|
||||
# Partition type OSD has a unique globally identifier
|
||||
CEPH_OSD_GUID="4FBD7E29-9D25-41B8-AFD0-062C0CEFF05D"
|
||||
CEPH_JOURNAL_GUID="45B0969E-9B03-4F30-B4C6-B4B80CEFF106"
|
||||
CEPH_REGULAR_OSD_GUID="4FBD7E29-9D25-41B8-AFD0-062C0CEFF05D"
|
||||
CEPH_REGULAR_JOURNAL_GUID="45B0969E-9B03-4F30-B4C6-B4B80CEFF106"
|
||||
CEPH_MPATH_OSD_GUID="4FBD7E29-8AE0-4982-BF9D-5A8D867AF560"
|
||||
CEPH_MPATH_JOURNAL_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
|
||||
|
@ -1156,7 +1158,7 @@ else
|
|||
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 ]; then
|
||||
if [ "$part_type_guid" == $CEPH_REGULAR_OSD_GUID -o "$part_type_guid" == $CEPH_MPATH_OSD_GUID ]; then
|
||||
wlog "OSD found on $dev, skipping wipe"
|
||||
wipe_dev="false"
|
||||
break
|
||||
|
@ -1319,7 +1321,7 @@ do
|
|||
fi
|
||||
fi
|
||||
|
||||
if [ $WIPE_CEPH_OSDS == "true" -a "$part_type_guid" == $CEPH_JOURNAL_GUID ]; then
|
||||
if [[ $WIPE_CEPH_OSDS == "true" && ( "$part_type_guid" == $CEPH_REGULAR_JOURNAL_GUID || "$part_type_guid" == $CEPH_MPATH_JOURNAL_GUID ) ]]; then
|
||||
# Journal partitions require additional wiping. Based on the ceph-manage-journal.py
|
||||
# script in the integ repo (at the ceph/ceph/files/ceph-manage-journal.py location)
|
||||
# wiping 100MB of data at the beginning of the partition should be enough. We also
|
||||
|
|
Loading…
Reference in New Issue