2019-11-26 09:53:30 +01:00
|
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
|
|
# Vars {{{
|
|
|
|
|
debug="0"
|
|
|
|
|
|
|
|
|
|
osd_id_start="0"
|
|
|
|
|
osd_id_end=$(sudo ceph osd getmaxosd | cut -d" " -f3)
|
|
|
|
|
# }}}
|
|
|
|
|
|
|
|
|
|
# Functions
|
|
|
|
|
# Check if an OSD exists {{{
|
|
|
|
|
check_osd() {
|
|
|
|
|
_osd_id="${1}"
|
|
|
|
|
|
|
|
|
|
[ "${debug}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG : check_osd func − OSD ID to check : ${_osd_id}."
|
|
|
|
|
|
|
|
|
|
sudo ceph osd find "${_osd_id}" > /dev/null 2>&1
|
|
|
|
|
return $?
|
|
|
|
|
}
|
|
|
|
|
# }}}
|
|
|
|
|
|
|
|
|
|
osd_id="${osd_id_start}"
|
|
|
|
|
|
|
|
|
|
while [ "${osd_id}" -lt "${osd_id_end}" ]; do
|
|
|
|
|
|
|
|
|
|
[ "${debug}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG : Check if OSD ${osd_id} exists."
|
|
|
|
|
|
2019-11-26 09:55:26 +01:00
|
|
|
|
if check_osd "${osd_id}"
|
|
|
|
|
then
|
2019-11-26 09:53:30 +01:00
|
|
|
|
printf '%b\n' "True"
|
|
|
|
|
else
|
|
|
|
|
printf '%b\n' "False"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
## Increment OSD ID
|
|
|
|
|
osd_id=$((osd_id+1))
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
exit 0
|