2018-02-20 18:07:33 +00:00
|
|
|
#!/bin/sh
|
|
|
|
# Nico Schottelius, 2018-02-20
|
|
|
|
# Copyright ungleich glarus ag
|
|
|
|
|
|
|
|
set -e
|
|
|
|
set -x
|
|
|
|
|
|
|
|
tmpdir=$(mktemp -d)
|
|
|
|
|
2021-04-19 14:51:45 +00:00
|
|
|
# XFS based partition scheme
|
2018-03-04 17:40:24 +00:00
|
|
|
for dev in $(fdisk -l | awk '$6 ~/Ceph/ { print $1 }'); do
|
2018-02-20 18:07:33 +00:00
|
|
|
mount "$dev" "$tmpdir"
|
|
|
|
id=$(cat "${tmpdir}/whoami")
|
2018-02-20 18:12:51 +00:00
|
|
|
|
|
|
|
# Chown the dev device to be accessible for ceph
|
2018-02-20 18:13:19 +00:00
|
|
|
chown ceph:ceph "${tmpdir}/block"
|
2018-02-20 18:12:51 +00:00
|
|
|
|
2018-02-20 18:07:33 +00:00
|
|
|
umount "$dev"
|
|
|
|
|
|
|
|
dir="/var/lib/ceph/osd/ceph-$id"
|
|
|
|
mkdir -p "$dir"
|
|
|
|
mount "$dev" "$dir"
|
|
|
|
|
2018-04-04 15:28:42 +00:00
|
|
|
if [ -e /etc/monit ]; then
|
2018-04-04 15:29:37 +00:00
|
|
|
/opt/ungleich-tools/monit-ceph-create-start "osd.$id"
|
2018-04-04 15:28:42 +00:00
|
|
|
else
|
|
|
|
/etc/init.d/ceph start "osd.$id"
|
|
|
|
fi
|
2018-02-20 18:07:33 +00:00
|
|
|
done
|
2018-03-04 17:41:18 +00:00
|
|
|
|
2021-09-05 09:48:00 +00:00
|
|
|
# LVM based / manual does not work atm:
|
|
|
|
# + grep ceph.block_device
|
|
|
|
# + sed -e s/.*ceph.osd_id=// -e s/,.*//
|
|
|
|
# + ceph-volume lvm activate --no-systemd 112
|
|
|
|
# --> UnboundLocalError: local variable 'tags' referenced before assignment
|
|
|
|
|
|
|
|
#for osdid in $(lvs -o lv_tags | grep ceph.block_device| sed -e 's/.*ceph.osd_id=//' -e 's/,.*//'); do
|
|
|
|
# ceph-volume lvm activate --no-systemd $osdid
|
|
|
|
# /opt/ungleich-tools/monit-ceph-create-start "osd.$osdid"
|
|
|
|
#done
|
|
|
|
|
2021-09-09 07:16:14 +00:00
|
|
|
# Activate all volumes in the OS
|
|
|
|
vgchange -ay
|
2021-09-05 09:48:00 +00:00
|
|
|
# Using this with a fake /bin/systemctl
|
|
|
|
ceph-volume lvm activate --all
|
2021-09-05 06:59:17 +00:00
|
|
|
|
2018-03-04 17:41:18 +00:00
|
|
|
rmdir "$tmpdir"
|