[find-osd-device] fix initial script issues
This commit is contained in:
parent
59031104a8
commit
f3187d110a
1 changed files with 5 additions and 7 deletions
|
@ -9,18 +9,16 @@ if [ $# -ne 1 ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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 ! mount | grep -q " on ${osd_path} "; then
|
||||||
|
|
||||||
if [ -z "${mountpath}" ]; then
|
|
||||||
echo "Nothing mounted on ${osd_path}, are you on the right host?"
|
echo "Nothing mounted on ${osd_path}, are you on the right host?"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
blockdev=$(readlink -f ${mountpath}/block)
|
blockdev=$(readlink -f ${osd_path}/block)
|
||||||
|
|
||||||
# Is directly referring to sdX? print and exit
|
# Is directly referring to sdX? print and exit
|
||||||
if echo $blockdev | grep -q ^/dev/sd; then
|
if echo $blockdev | grep -q ^/dev/sd; then
|
||||||
|
@ -29,7 +27,7 @@ if echo $blockdev | grep -q ^/dev/sd; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# try the non-recursive variant, resulting in finding pv/vg
|
# 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 }')
|
lvm_vg=$(echo $blockdev | awk -F/ '{ print $3 }')
|
||||||
|
|
||||||
pv_name=$(pvdisplay | grep -B1 $lvm_vg | awk '/PV Name/ { print $3 }')
|
pv_name=$(pvdisplay | grep -B1 $lvm_vg | awk '/PV Name/ { print $3 }')
|
||||||
|
|
Loading…
Add table
Reference in a new issue