diff --git a/kickstart/files/kickstart.cfg b/kickstart/files/kickstart.cfg index f497ab86..7a699c3f 100644 --- a/kickstart/files/kickstart.cfg +++ b/kickstart/files/kickstart.cfg @@ -1458,33 +1458,26 @@ else if [ ${WIPE_CEPH_OSDS} == "false" ] ; then wipe_dev="true" - exec_no_fds "$STOR_DEV_FDS" "pvs" | grep -q "$dev *ceph" - if [ $? -eq 0 ] ; then - wlog "skip rook provisoned disk $dev" - continue + # Check if the disk is Rook Ceph OSD + fs_type=$(blkid -o value -s TYPE "${dev}") + if [ "${fs_type}" == "ceph_bluestore" ]; then + wlog "BlueStore OSD found on $dev, skipping wipe" + wipe_dev="false" + else + 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=$(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 -o "$part_type_guid" == $CEPH_OSD_MPATH_GUID ]; then + wlog "OSD found on $dev, skipping wipe" + wipe_dev="false" + break + fi + done fi - 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=$(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 -o "$part_type_guid" == $CEPH_OSD_MPATH_GUID ]; then - wlog "OSD found on $dev, skipping wipe" - wipe_dev="false" - break - fi - - dev_part_prefix=$(get_part_prefix "${dev}") - exec_no_fds "$STOR_DEV_FDS" "pvs" | grep -q -e "${dev_part_prefix}${part_number} *ceph" -e "${dev_part_prefix}p${part_number} *ceph" - if [ $? -eq 0 ]; then - wlog "Rook OSD found on $dev_part_prefix$part_number, skip wipe" - wipe_dev="false" - break - fi - done - if [ "$wipe_dev" == "false" ] ; then continue fi @@ -1513,6 +1506,15 @@ inst_dev=$(get_disk "${INSTDEV}") for dev in ${WIPE_HDD//,/ } ; do ilog "Wiping $dev" + # Check if the disk is Rook Ceph OSD + # see https://github.com/rook/rook/blob/master/Documentation/Storage-Configuration/ceph-teardown.md#zapping-devices + fs_type=$(blkid -o value -s TYPE "${dev}") + if [ "${fs_type}" == "ceph_bluestore" ]; then + sgdisk --zap-all "${dev}" + wipefs -a "${dev}" + continue + fi + # Clear previous GPT tables or LVM data on each disk. # # Rule: Exclude the persistent 'Platform backup' partition. diff --git a/kickstart/files/miniboot.cfg b/kickstart/files/miniboot.cfg index db37b70e..67a3d90d 100644 --- a/kickstart/files/miniboot.cfg +++ b/kickstart/files/miniboot.cfg @@ -1,5 +1,5 @@ # -# Copyright (c) 2022-2023 Wind River Systems, Inc. +# Copyright (c) 2022-2024 Wind River Systems, Inc. # SPDX-License-Identifier: Apache-2.0 # ############################################################################ @@ -1361,33 +1361,26 @@ else if [ ${WIPE_CEPH_OSDS} == "false" ]; then wipe_dev="true" - exec_no_fds "$STOR_DEV_FDS" "pvs" | grep -q "$dev *ceph" - if [ $? -eq 0 ]; then - wlog "skip rook provisoned disk $dev" - continue + # Check if the disk is Rook Ceph OSD + fs_type=$(blkid -o value -s TYPE "${dev}") + if [ "${fs_type}" == "ceph_bluestore" ]; then + wlog "BlueStore OSD found on $dev, skipping wipe" + wipe_dev="false" + else + 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=$(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 -o "$part_type_guid" == $CEPH_OSD_MPATH_GUID ]; then + wlog "OSD found on $dev, skipping wipe" + wipe_dev="false" + break + fi + done fi - 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=$(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 -o "$part_type_guid" == $CEPH_OSD_MPATH_GUID ]; then - wlog "OSD found on $dev, skipping wipe" - wipe_dev="false" - break - fi - - dev_part_prefix=$(get_part_prefix "${dev}") - exec_no_fds "$STOR_DEV_FDS" "pvs" | grep -q -e "${dev_part_prefix}${part_number} *ceph" -e "${dev_part_prefix}p${part_number} *ceph" - if [ $? -eq 0 ]; then - wlog "Rook OSD found on $dev_part_prefix$part_number, skip wipe" - wipe_dev="false" - break - fi - done - if [ "$wipe_dev" == "false" ]; then continue fi @@ -1416,6 +1409,15 @@ inst_dev=$(get_disk "${INSTDEV}") for dev in ${WIPE_HDD//,/ } ; do ilog "Wiping $dev" + # Check if the disk is Rook Ceph OSD + # see https://github.com/rook/rook/blob/master/Documentation/Storage-Configuration/ceph-teardown.md#zapping-devices + fs_type=$(blkid -o value -s TYPE "${dev}") + if [ "${fs_type}" == "ceph_bluestore" ]; then + sgdisk --zap-all "${dev}" + wipefs -a "${dev}" + continue + fi + # Clear previous GPT tables or LVM data on each disk. # # Rule: Exclude the persistent 'Platform backup' partition.