Merge "B&R: Skip Ceph osds from getting wiped during initial installation"
This commit is contained in:
commit
dcd4b66768
@ -66,6 +66,16 @@ fi
|
||||
# Deactivate existing volume groups to avoid Anaconda issues with pre-existing groups
|
||||
vgs --noheadings -o vg_name | xargs --no-run-if-empty -n 1 vgchange -an
|
||||
|
||||
# Check if active controller is available
|
||||
curl -sf http://pxecontroller:6385/v1 2>&1 >/dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "Active controller detected."
|
||||
ACTIVE_EXISTS="true"
|
||||
else
|
||||
echo "No active controller detected, this is the initial install."
|
||||
ACTIVE_EXISTS="false"
|
||||
fi
|
||||
|
||||
ONLYUSE_HDD=""
|
||||
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
|
||||
@ -79,6 +89,10 @@ if [ "$(curl -sf http://pxecontroller:6385/v1/upgrade/$(hostname)/in_upgrade 2>/
|
||||
else
|
||||
# Make a list of all the hard drives that are to be wiped
|
||||
WIPE_HDD=""
|
||||
# Partition type OSD has a unique globally identifier
|
||||
part_type_guid_str="Partition GUID code"
|
||||
CEPH_OSD_GUID="4FBD7E29-9D25-41B8-AFD0-062C0CEFF05D"
|
||||
|
||||
for f in /dev/disk/by-path/*
|
||||
do
|
||||
dev=$(readlink -f $f)
|
||||
@ -91,16 +105,37 @@ else
|
||||
# Avoid wiping USB drives
|
||||
udevadm info --query=property --name=$dev |grep -q '^ID_BUS=usb' && continue
|
||||
|
||||
# Avoid wiping ceph osds on initial install
|
||||
if [ ${ACTIVE_EXISTS} == "false" ]; then
|
||||
wipe_dev="true"
|
||||
part_numbers=( `parted -s $dev print | awk '$1 == "Number" {i=1; next}; i {print $1}'` )
|
||||
# Scanning the partitions looking for CEPH OSDs and
|
||||
# skipping any disk found with such partitions
|
||||
for part_number in "${part_numbers[@]}"; do
|
||||
sgdisk_part_info=$(flock $dev 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
|
||||
echo "OSD found on $dev, skipping wipe"
|
||||
wipe_dev="false"
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ "$wipe_dev" == "false" ]; then
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
|
||||
# Add device to the wipe list
|
||||
devname=$(basename $dev)
|
||||
if [ -e $dev -a "$ISO_DEV" != "../../$devname" -a "$USB_DEV" != "../../$devname" ] ; then
|
||||
if [ -n "$WIPE_HDD" ] ; then
|
||||
if [ -e $dev -a "$ISO_DEV" != "../../$devname" -a "$USB_DEV" != "../../$devname" ]; then
|
||||
if [ -n "$WIPE_HDD" ]; then
|
||||
WIPE_HDD=$WIPE_HDD,$dev
|
||||
else
|
||||
WIPE_HDD=$dev
|
||||
fi
|
||||
fi
|
||||
done
|
||||
echo "Not in upgrade, wiping all disks: $WIPE_HDD"
|
||||
echo "Not in upgrade, wiping disks: $WIPE_HDD"
|
||||
fi
|
||||
|
||||
for dev in ${WIPE_HDD//,/ }
|
||||
|
Loading…
x
Reference in New Issue
Block a user