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
|
# 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
|
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=""
|
ONLYUSE_HDD=""
|
||||||
if [ "$(curl -sf http://pxecontroller:6385/v1/upgrade/$(hostname)/in_upgrade 2>/dev/null)" = "true" ]; then
|
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
|
# 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
|
else
|
||||||
# Make a list of all the hard drives that are to be wiped
|
# Make a list of all the hard drives that are to be wiped
|
||||||
WIPE_HDD=""
|
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/*
|
for f in /dev/disk/by-path/*
|
||||||
do
|
do
|
||||||
dev=$(readlink -f $f)
|
dev=$(readlink -f $f)
|
||||||
@ -91,6 +105,27 @@ else
|
|||||||
# Avoid wiping USB drives
|
# Avoid wiping USB drives
|
||||||
udevadm info --query=property --name=$dev |grep -q '^ID_BUS=usb' && continue
|
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)
|
devname=$(basename $dev)
|
||||||
if [ -e $dev -a "$ISO_DEV" != "../../$devname" -a "$USB_DEV" != "../../$devname" ]; then
|
if [ -e $dev -a "$ISO_DEV" != "../../$devname" -a "$USB_DEV" != "../../$devname" ]; then
|
||||||
if [ -n "$WIPE_HDD" ]; then
|
if [ -n "$WIPE_HDD" ]; then
|
||||||
@ -100,7 +135,7 @@ else
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
echo "Not in upgrade, wiping all disks: $WIPE_HDD"
|
echo "Not in upgrade, wiping disks: $WIPE_HDD"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for dev in ${WIPE_HDD//,/ }
|
for dev in ${WIPE_HDD//,/ }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user