[find-osd-device] fix initial script issues

This commit is contained in:
Nico Schottelius 2023-06-10 14:07:14 +02:00
parent 59031104a8
commit f3187d110a
1 changed files with 5 additions and 7 deletions

View File

@ -9,18 +9,16 @@ if [ $# -ne 1 ]; then
exit 1
fi
osdid=$1; shift
osd_id=$1; shift
osd_path=/var/lib/ceph/osd/ceph-${osdid}
osd_path=/var/lib/ceph/osd/ceph-${osd_id}
mountpath=$(mount | grep "on ${osd_path} ")
if [ -z "${mountpath}" ]; then
if ! mount | grep -q " on ${osd_path} "; then
echo "Nothing mounted on ${osd_path}, are you on the right host?"
exit 1
fi
blockdev=$(readlink -f ${mountpath}/block)
blockdev=$(readlink -f ${osd_path}/block)
# Is directly referring to sdX? print and exit
if echo $blockdev | grep -q ^/dev/sd; then
@ -29,7 +27,7 @@ if echo $blockdev | grep -q ^/dev/sd; then
fi
# try the non-recursive variant, resulting in finding pv/vg
blockdev=$(readlink ${mountpath}/block)
blockdev=$(readlink ${osd_path}/block)
lvm_vg=$(echo $blockdev | awk -F/ '{ print $3 }')
pv_name=$(pvdisplay | grep -B1 $lvm_vg | awk '/PV Name/ { print $3 }')