From 173bf928df697f359697170a576630155e193602 Mon Sep 17 00:00:00 2001 From: "Taylor, Stephen (st053q)" Date: Fri, 25 Sep 2020 10:50:31 -0600 Subject: [PATCH] [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 --- ceph-osd/Chart.yaml | 2 +- .../bin/osd/ceph-volume/_init-with-ceph-volume.sh.tpl | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ceph-osd/Chart.yaml b/ceph-osd/Chart.yaml index 8bd6e093f..a97800f32 100644 --- a/ceph-osd/Chart.yaml +++ b/ceph-osd/Chart.yaml @@ -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 ... diff --git a/ceph-osd/templates/bin/osd/ceph-volume/_init-with-ceph-volume.sh.tpl b/ceph-osd/templates/bin/osd/ceph-volume/_init-with-ceph-volume.sh.tpl index 510a73af4..4aceffae9 100644 --- a/ceph-osd/templates/bin/osd/ceph-volume/_init-with-ceph-volume.sh.tpl +++ b/ceph-osd/templates/bin/osd/ceph-volume/_init-with-ceph-volume.sh.tpl @@ -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