From 63e43d98b772d885d7aa4f775dd4adb7049b4682 Mon Sep 17 00:00:00 2001 From: Chinasubbareddy Mallavarapu Date: Wed, 29 Jan 2020 19:38:34 -0600 Subject: [PATCH] [ceph-osd] Fix to check osd disk name instead of disk path This is to fix the logic to use osd device name instaed of whole disk path while osd initilizing. also correct the ceph osd ls command to use correct keyring. Change-Id: I90f0c3fd5d1e1b835326b1c690582990f7ca15cb --- .../bin/osd/ceph-volume/_init-with-ceph-volume.sh.tpl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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 312207dc3..089217a0c 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 @@ -83,7 +83,7 @@ function osd_disk_prepare { fi else if [[ ! -z ${OSD_ID} ]]; then - if ceph osd ls |grep ${OSD_ID}; then + if ceph --name client.bootstrap-osd --keyring $OSD_BOOTSTRAP_KEYRING osd ls |grep ${OSD_ID}; then echo "Running bluestore mode and ${OSD_DEVICE} already bootstrapped" else echo "found the wrong osd id which does not belong to current ceph cluster" @@ -93,7 +93,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_DEVICE}; then + osd_dev_split=$(basename ${OSD_DEVICE}) + if dmsetup ls |grep -i ${osd_dev_split}; then CEPH_DISK_USED=1 fi if [[ ${OSD_FORCE_REPAIR} -eq 1 ]] && [ ${CEPH_DISK_USED} -ne 1 ]; then