]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
upstart: new rbd-mirror daemon scripts
authorJason Dillaman <dillaman@redhat.com>
Fri, 18 Mar 2016 19:06:21 +0000 (15:06 -0400)
committerJason Dillaman <dillaman@redhat.com>
Fri, 18 Mar 2016 21:53:05 +0000 (17:53 -0400)
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/Makefile.am
src/upstart/ceph-rbd-mirror-all-starter.conf [new file with mode: 0644]
src/upstart/ceph-rbd-mirror-all.conf [new file with mode: 0644]
src/upstart/ceph-rbd-mirror.conf [new file with mode: 0644]

index d2f99b85a70415c9b654125eb3a43f8cea80e758..cc973b37531f3a7e1e6156320cfde365dffcb190 100644 (file)
@@ -119,6 +119,9 @@ EXTRA_DIST += \
        $(srcdir)/upstart/ceph-mds.conf \
        $(srcdir)/upstart/ceph-mds-all.conf \
        $(srcdir)/upstart/ceph-mds-all-starter.conf \
+       $(srcdir)/upstart/ceph-rbd-mirror.conf \
+       $(srcdir)/upstart/ceph-rbd-mirror-all.conf \
+       $(srcdir)/upstart/ceph-rbd-mirror-all-starter.conf \
        $(srcdir)/upstart/radosgw.conf \
        $(srcdir)/upstart/radosgw-all.conf \
        $(srcdir)/upstart/radosgw-all-starter.conf \
diff --git a/src/upstart/ceph-rbd-mirror-all-starter.conf b/src/upstart/ceph-rbd-mirror-all-starter.conf
new file mode 100644 (file)
index 0000000..038cdb1
--- /dev/null
@@ -0,0 +1,18 @@
+description "Ceph rbd-mirror (task to start all instances)"
+
+start on starting ceph-rbd-mirror-all
+
+task
+
+script
+  set -e
+  # TODO what's the valid charset for cluster names and daemon ids?
+  find -L /var/lib/ceph/rbd-mirror/ -mindepth 1 -maxdepth 1 -regextype posix-egrep -regex '.*/[A-Za-z0-9]+-[A-Za-z0-9._-]+' -printf '%P\n' \
+  | while read f; do
+    if [ -e "/var/lib/ceph/rbd-mirror/$f/done" ]; then
+        cluster="${f%%-*}"
+        id="${f#*-}"
+        initctl emit ceph-rbd-mirror cluster="$cluster" id="$id"
+    fi
+  done
+end script
diff --git a/src/upstart/ceph-rbd-mirror-all.conf b/src/upstart/ceph-rbd-mirror-all.conf
new file mode 100644 (file)
index 0000000..7e6126b
--- /dev/null
@@ -0,0 +1,4 @@
+description "Ceph rbd mirror (all instances)"
+
+start on starting ceph-all
+stop on runlevel [!2345] or stopping ceph-all
diff --git a/src/upstart/ceph-rbd-mirror.conf b/src/upstart/ceph-rbd-mirror.conf
new file mode 100644 (file)
index 0000000..a990111
--- /dev/null
@@ -0,0 +1,26 @@
+description "Ceph rbd mirror"
+
+start on ceph-rbd-mirror
+stop on runlevel [!2345] or stopping ceph-rbd-mirror-all
+
+respawn
+respawn limit 3 1800
+
+limit nofile 8096 65536
+
+pre-start script
+    set -e
+    test -x /usr/bin/rbd-mirror || { stop; exit 0; }
+    test -d "/var/lib/ceph/rbd-mirror/${cluster:-ceph}-$id" || { stop; exit 0; }
+
+    install -d -m0770 -o ceph -g ceph /var/run/ceph
+end script
+
+instance ${cluster:-ceph}/$id
+export cluster
+export id
+
+# this breaks oneiric
+#usage "cluster = name of cluster (defaults to 'ceph'); id = instance id"
+
+exec /usr/bin/rbd-mirror --cluster="${cluster:-ceph}" --id "$id" -f --setuser ceph --setgroup ceph