]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | #!/bin/sh |
2 | ||
3 | if [ `uname` = FreeBSD ]; then | |
4 | GETOPT=/usr/local/bin/getopt | |
5 | else | |
6 | GETOPT=getopt | |
7 | fi | |
8 | ||
9 | eval set -- "$(${GETOPT} -o i: --long id:,cluster: -- $@)" | |
10 | ||
11 | while true ; do | |
12 | case "$1" in | |
13 | -i|--id) id=$2; shift 2 ;; | |
14 | --cluster) cluster=$2; shift 2 ;; | |
15 | --) shift ; break ;; | |
16 | esac | |
17 | done | |
18 | ||
19 | if [ -z "$id" ]; then | |
20 | echo "Usage: $0 [OPTIONS]" | |
21 | echo "--id/-i ID set ID portion of my name" | |
22 | echo "--cluster NAME set cluster name (default: ceph)" | |
23 | exit 1; | |
24 | fi | |
25 | ||
26 | data="/var/lib/ceph/osd/${cluster:-ceph}-$id" | |
27 | ||
28 | # assert data directory exists - see http://tracker.ceph.com/issues/17091 | |
29 | if [ ! -d "$data" ]; then | |
30 | echo "OSD data directory $data does not exist; bailing out." 1>&2 | |
31 | exit 1 | |
32 | fi | |
33 | ||
34 | journal="$data/journal" | |
35 | ||
36 | if [ -L "$journal" -a ! -e "$journal" ]; then | |
37 | udevadm settle --timeout=5 || : | |
38 | if [ -L "$journal" -a ! -e "$journal" ]; then | |
39 | echo "ceph-osd(${cluster:-ceph}-$id): journal not present, not starting yet." 1>&2 | |
40 | exit 0 | |
41 | fi | |
42 | fi | |
43 | ||
44 | # ensure ownership is correct | |
45 | owner=`stat -c %U $data/.` | |
46 | if [ $owner != 'ceph' -a $owner != 'root' ]; then | |
47 | echo "ceph-osd data dir $data is not owned by 'ceph' or 'root'" | |
48 | echo "you must 'chown -R ceph:ceph ...' or similar to fix ownership" | |
49 | exit 1 | |
50 | fi | |
51 | ||
52 | exit 0 |