~upstart-devel/upstart/upstart-jobs

« back to all changes in this revision

Viewing changes to vivid/etc/init/ceph-osd.conf

  • Committer: Dimitri John Ledkov
  • Date: 2014-11-19 12:58:41 UTC
  • Revision ID: dimitri.j.ledkov@intel.com-20141119125841-98dr37roy8dvcv3b
auto update

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
description "Ceph OSD"
 
2
 
 
3
start on ceph-osd
 
4
stop on runlevel [!2345] or stopping ceph-osd-all
 
5
 
 
6
respawn
 
7
respawn limit 5 30
 
8
 
 
9
limit nofile 32768 32768
 
10
 
 
11
pre-start script
 
12
    set -e
 
13
    test -x /usr/bin/ceph-osd || { stop; exit 0; }
 
14
    test -d "/var/lib/ceph/osd/${cluster:-ceph}-$id" || { stop; exit 0; }
 
15
 
 
16
    install -d -m0755 /var/run/ceph
 
17
 
 
18
    update="$(ceph-conf --cluster=${cluster:-ceph} --name=osd.$id --lookup osd_crush_update_on_start || :)"
 
19
    if [ "${update:-1}" = "1" -o "${update:-1}" = "true" ]; then
 
20
        # update location in crush
 
21
        hook="$(ceph-conf --cluster=${cluster:-ceph} --name=osd.$id --lookup osd_crush_location_hook || :)"
 
22
        if [ -z "$hook" ]; then
 
23
            hook="/usr/bin/ceph-crush-location"
 
24
        fi
 
25
        location="$($hook --cluster ${cluster:-ceph} --id $id --type osd)"
 
26
        weight="$(ceph-conf --cluster=${cluster:-ceph} --name=osd.$id --lookup osd_crush_initial_weight || :)"
 
27
        defaultweight=`df -P -k /var/lib/ceph/osd/${cluster:-ceph}-$id/ | tail -1 | awk '{ d= $2/1073741824 ; r = sprintf("%.2f", d); print r }'`
 
28
        ceph \
 
29
            --cluster="${cluster:-ceph}" \
 
30
            --name="osd.$id" \
 
31
            --keyring="/var/lib/ceph/osd/${cluster:-ceph}-$id/keyring" \
 
32
            osd crush create-or-move \
 
33
            -- \
 
34
            "$id" \
 
35
            "${weight:-${defaultweight:-1}}" \
 
36
            $location
 
37
    fi
 
38
 
 
39
    journal="/var/lib/ceph/osd/${cluster:-ceph}-$id/journal"
 
40
    if [ -L "$journal" -a ! -e "$journal" ]; then
 
41
        udevadm settle --timeout=5 || :
 
42
        if [ -L "$journal" -a ! -e "$journal" ]; then
 
43
            echo "ceph-osd($UPSTART_INSTANCE): journal not present, not starting yet." 1>&2
 
44
            stop
 
45
            exit 0
 
46
        fi
 
47
    fi
 
48
end script
 
49
 
 
50
instance ${cluster:-ceph}/$id
 
51
export cluster
 
52
export id
 
53
 
 
54
exec /usr/bin/ceph-osd --cluster="${cluster:-ceph}" -i "$id" -f