[ceph-osd] Search for complete logical volume name for OSD data volumes

The existing search for logical volumes to determine if an OSD data
is already being used is incomplete and can yield false positives in
some cases. This change makes the search more correct and specific in
order to avoid those.

Change-Id: Ic2d06f7539567f0948efef563c1942b71e0293ff
This commit is contained in:
Taylor, Stephen (st053q) 2020-09-25 10:50:31 -06:00 committed by Stephen Taylor
parent aad20a35c4
commit 173bf928df
2 changed files with 4 additions and 4 deletions

View File

@ -15,6 +15,6 @@ apiVersion: v1
appVersion: v1.0.0
description: OpenStack-Helm Ceph OSD
name: ceph-osd
version: 0.1.2
version: 0.1.3
home: https://github.com/ceph/ceph
...

View File

@ -199,7 +199,7 @@ function prep_device {
fi
fi
else
logical_devices=$(get_lvm_path_from_device "pv_name=~${BLOCK_DEVICE},lv_name=~dev-${osd_dev_split}")
logical_devices=$(get_lvm_path_from_device "pv_name=~${BLOCK_DEVICE},lv_name=~${lv_name}")
if [[ -n "$logical_devices" ]]; then
dmsetup remove $logical_devices
disk_zap "${OSD_DEVICE}"
@ -241,7 +241,6 @@ function osd_disk_prepare {
#search for some ceph metadata on the disk based on the status of the disk/lvm in filestore
CEPH_DISK_USED=0
CEPH_LVM_PREPARE=1
osd_dev_split=$(basename "${OSD_DEVICE}")
udev_settle
OSD_ID=$(get_osd_id_from_device ${OSD_DEVICE})
OSD_FSID=$(get_cluster_fsid_from_device ${OSD_DEVICE})
@ -288,7 +287,8 @@ function osd_disk_prepare {
DM_DEV=${OSD_DEVICE}$(sgdisk --print ${OSD_DEVICE} | grep "F800" | awk '{print $1}')
CEPH_DISK_USED=1
else
if dmsetup ls |grep -i ${osd_dev_split}|grep -v "db--dev\|wal--dev"; then
dm_lv_name="$(get_lv_name_from_device ${OSD_DEVICE} lv | sed 's/-/--/g')"
if [[ ! -z "${dm_lv_name}" ]] && [[ ! -z "$(dmsetup ls | grep ${dm_lv_name})" ]]; then
CEPH_DISK_USED=1
fi
if [[ ${OSD_FORCE_REPAIR} -eq 1 ]] && [ ${CEPH_DISK_USED} -ne 1 ]; then