summaryrefslogtreecommitdiff
path: root/src/upstart
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2012-06-02 15:19:28 -0700
committerSage Weil <sage@inktank.com>2012-06-02 15:19:28 -0700
commit3764ca6115fe7c0bf8dcba448af012625ea5abc3 (patch)
tree7362c7fcc400eac62e2c57d01e310e1f7ee33c3b /src/upstart
parentf871d83785a7b64de829a7d6d892847cea6bd24f (diff)
downloadceph-3764ca6115fe7c0bf8dcba448af012625ea5abc3.tar.gz
upstart: simplify start; allow group stop via an abstract job
Use a 'ceph-mds' or 'ceph-mon' event to start instances instead of explicitly calling start. This avoids the ugly is-this-already-running check. [Thanks Guilhem Lettron for that!] Make the -all job abstract (which means it stays started and can be stopped). Trigger a helper task (-all-starter) to trigger instance start. Make instances stop with the -all task. This allows you to do start ceph-mds-all stop ceph-mds-all start ceph-mds id=foo start ceph-mds-all stop ceph-mds id=bar stop ceph-mds-all but not start ceph-mds id=foo stop ceph-mds-all because ceph-mds-all isn't running. Not quite as flexible in sysvinit in that regard, but good enough for me. Fixes: #2414 Signed-off-by: Sage Weil <sage@inktank.com>
Diffstat (limited to 'src/upstart')
-rw-r--r--src/upstart/ceph-mds-all-starter.conf18
-rw-r--r--src/upstart/ceph-mds-all.conf27
-rw-r--r--src/upstart/ceph-mds.conf6
-rw-r--r--src/upstart/ceph-mon-all-starter.conf19
-rw-r--r--src/upstart/ceph-mon-all.conf27
-rw-r--r--src/upstart/ceph-mon.conf6
6 files changed, 49 insertions, 54 deletions
diff --git a/src/upstart/ceph-mds-all-starter.conf b/src/upstart/ceph-mds-all-starter.conf
new file mode 100644
index 00000000000..4d4de6cdace
--- /dev/null
+++ b/src/upstart/ceph-mds-all-starter.conf
@@ -0,0 +1,18 @@
+description "Ceph MDS (task to start all instances)"
+
+start on starting ceph-mds-all
+
+task
+
+script
+ set -e
+ # TODO what's the valid charset for cluster names and mds ids?
+ find /var/lib/ceph/mds/ -mindepth 1 -maxdepth 1 -regextype posix-egrep -regex '.*/[a-z0-9]+-[a-z0-9]+' -printf '%P\n' \
+ | while read f; do
+ if [ -e "/var/lib/ceph/mds/$f/done" ]; then
+ cluster="${f%%-*}"
+ id="${f#*-}"
+ initctl emit ceph-mds cluster="$cluster" id="$id"
+ fi
+ done
+end script
diff --git a/src/upstart/ceph-mds-all.conf b/src/upstart/ceph-mds-all.conf
index 776d31118c2..35c2e06e664 100644
--- a/src/upstart/ceph-mds-all.conf
+++ b/src/upstart/ceph-mds-all.conf
@@ -1,26 +1 @@
-description "Ceph MDS (start all instances)"
-
-start on filesystem
-
-task
-
-script
- set -e
- # TODO what's the valid charset for cluster names and mds ids?
- find /var/lib/ceph/mds/ -mindepth 1 -maxdepth 1 -regextype posix-egrep -regex '.*/[a-z0-9]+-[a-z0-9]+' -printf '%P\n' \
- | while read f; do
- if [ -e "/var/lib/ceph/mds/$f/done" ]; then
- cluster="${f%%-*}"
- id="${f#*-}"
-
- # upstart start(8) fails if the job is already running
- # https://bugs.launchpad.net/upstart/+bug/878322
-
- # also cannot ask for status of instance that isn't running at
- # that time, so just list all and filter that
- if initctl list|mawk '$1=="ceph-mds" && $2=="(" CLUSTER "/" INSTANCE ")" && $3~/start\// { exit 1 }' CLUSTER="$cluster" INSTANCE="$id"; then
- start ceph-mds cluster="$cluster" id="$id"
- fi
- fi
- done
-end script
+description "Ceph MDS (all instances)"
diff --git a/src/upstart/ceph-mds.conf b/src/upstart/ceph-mds.conf
index 2438a975b07..56aa5bce6b5 100644
--- a/src/upstart/ceph-mds.conf
+++ b/src/upstart/ceph-mds.conf
@@ -1,6 +1,7 @@
description "Ceph MDS"
-stop on runlevel [!2345]
+start on ceph-mds
+stop on runlevel [!2345] or stopping ceph-mds-all
respawn
respawn limit 5 30
@@ -15,4 +16,7 @@ end script
instance ${cluster:-ceph}/$id
+# this breaks oneiric
+#usage "cluster = name of cluster (defaults to 'ceph'); id = mds instance id"
+
exec /usr/bin/ceph-mds --cluster="${cluster:-ceph}" -i "$id" -f
diff --git a/src/upstart/ceph-mon-all-starter.conf b/src/upstart/ceph-mon-all-starter.conf
new file mode 100644
index 00000000000..bc3c4d41d8a
--- /dev/null
+++ b/src/upstart/ceph-mon-all-starter.conf
@@ -0,0 +1,19 @@
+description "Ceph MON (start all instances)"
+
+start on starting ceph-mon-all
+
+task
+
+script
+ set -e
+ # TODO what's the valid charset for cluster names and mon ids?
+ find /var/lib/ceph/mon/ -mindepth 1 -maxdepth 1 -regextype posix-egrep -regex '.*/[a-z0-9]+-[a-z0-9]+' -printf '%P\n' \
+ | while read f; do
+ if [ -e "/var/lib/ceph/mon/$f/done" ]; then
+ cluster="${f%%-*}"
+ id="${f#*-}"
+
+ initctl emit ceph-mon cluster="$cluster" id="$id"
+ fi
+ done
+end script
diff --git a/src/upstart/ceph-mon-all.conf b/src/upstart/ceph-mon-all.conf
index 749417d71ba..391cc598470 100644
--- a/src/upstart/ceph-mon-all.conf
+++ b/src/upstart/ceph-mon-all.conf
@@ -1,26 +1 @@
-description "Ceph MON (start all instances)"
-
-start on filesystem
-
-task
-
-script
- set -e
- # TODO what's the valid charset for cluster names and mon ids?
- find /var/lib/ceph/mon/ -mindepth 1 -maxdepth 1 -regextype posix-egrep -regex '.*/[a-z0-9]+-[a-z0-9]+' -printf '%P\n' \
- | while read f; do
- if [ -e "/var/lib/ceph/mon/$f/done" ]; then
- cluster="${f%%-*}"
- id="${f#*-}"
-
- # upstart start(8) fails if the job is already running
- # https://bugs.launchpad.net/upstart/+bug/878322
-
- # also cannot ask for status of instance that isn't running at
- # that time, so just list all and filter that
- if initctl list|mawk '$1=="ceph-mon" && $2=="(" CLUSTER "/" INSTANCE ")" && $3~/start\// { exit 1 }' CLUSTER="$cluster" INSTANCE="$id"; then
- start ceph-mon cluster="$cluster" id="$id"
- fi
- fi
- done
-end script
+description "Ceph monitor (all instances)"
diff --git a/src/upstart/ceph-mon.conf b/src/upstart/ceph-mon.conf
index 24ae88a2709..b38eff309f0 100644
--- a/src/upstart/ceph-mon.conf
+++ b/src/upstart/ceph-mon.conf
@@ -1,6 +1,7 @@
description "Ceph MON"
-stop on runlevel [!2345]
+start on ceph-mon
+stop on runlevel [!2345] or stopping ceph-mon-all
respawn
respawn limit 5 30
@@ -15,4 +16,7 @@ end script
instance ${cluster:-ceph}/$id
+# this breaks oneiric
+#usage "cluster = name of cluster (defaults to 'ceph'); id = monitor instance id"
+
exec /usr/bin/ceph-mon --cluster="${cluster:-ceph}" -i "$id" -f