ungleich-tools/ceph/ceph-osd-create-start
2021-04-19 16:51:45 +02:00

31 lines
911 B
Bash
Executable file

#!/bin/sh
# 17:19, 2018-02-09
# Nico Schottelius
if [ $# -lt 2 ]; then
echo "$0 disk class [nostart]"
echo "class = hdd or ssd"
echo "If specifying anything after the class, monit will not be created"
exit 1
fi
export DEV=$1;shift
export CLASS=$1; shift
# Ensure ceph-volume has all pre-requisites
if [ ! -f /var/lib/ceph/bootstrap-osd/ceph.keyring ]; then
mkdir -p /var/lib/ceph/bootstrap-osd
ceph auth get client.bootstrap-osd > /var/lib/ceph/bootstrap-osd/ceph.keyring
fi
if [ ! -f /etc/ceph/ceph.client.bootstrap-osd.keyring ]; then
ceph auth get client.bootstrap-osd > /etc/ceph/ceph.client.bootstrap-osd.keyring
fi
ceph-volume lvm prepare --data $DEV --crush-device-class $CLASS
if [ $# -eq 1 ]; then
echo "Not executing: /opt/ungleich-tools/monit-ceph-create-start osd.${osd_id}"
else
# Start it
/opt/ungleich-tools/monit-ceph-create-start osd.${osd_id}
fi