]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
init, upstart: prevent daemons being started by both
authorJosh Durgin <josh.durgin@inktank.com>
Mon, 25 Nov 2013 21:43:43 +0000 (13:43 -0800)
committerSage Weil <sage@inktank.com>
Wed, 4 Dec 2013 05:41:35 +0000 (21:41 -0800)
There can be only one init system starting a daemon. If there is a
host entry in ceph.conf for a daemon, sysvinit would try to start it
even if the daemon's directory did not include a sysvinit file. This
preserves backwards compatibility with older installs using sysvinit,
but if an upstart file is present in the daemon's directory, upstart
will try to start them, regardless of host entries in ceph.conf.

If there's an upstart file in a daemon's directory and a host entry
for that daemon in ceph.conf, both sysvinit and upstart would attempt
to manage it.

Fix this by only starting daemons if the marker file for the other
init system is not present. This maintains backwards compatibility
with older installs using neither sysvinit or upstart marker files,
and does not break any valid configurations. The only configuration
that would break is one with both sysvinit and upstart files present
for the same daemon.

Backport: emperor, dumpling
Reported-by: Tim Spriggs <tims@uahirise.org>
Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
(cherry picked from commit 5e34beb61b3f5a1ed4afd8ee2fe976de40f95ace)

src/ceph_common.sh
src/upstart/ceph-mds-all-starter.conf
src/upstart/ceph-mon-all-starter.conf
src/upstart/ceph-osd-all-starter.conf

index cedda4fb6c03f9e1bec8dffe0689a0cd73e73cfa..01781b754157fa94369f08b158f4f58fbe0a224b 100644 (file)
@@ -50,6 +50,10 @@ check_host() {
 
     #echo host for $name is $host, i am $hostname
 
+    if [ -e "/var/lib/ceph/$type/ceph-$id/upstart" ]; then
+       return 1
+    fi
+
     # sysvinit managed instance in standard location?
     if [ -e "/var/lib/ceph/$type/ceph-$id/sysvinit" ]; then
        host="$hostname"
index fa18b25e87c3b0c85f246dbdb893f21641b040db..5c1e02ef1cdb8442b6133958963e64dde2f58633 100644 (file)
@@ -9,7 +9,7 @@ script
   # TODO what's the valid charset for cluster names and mds ids?
   find -L /var/lib/ceph/mds/ -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/mds/$f/done" ] && [ -e "/var/lib/ceph/mds/$f/upstart" ]; then
+    if [ -e "/var/lib/ceph/mds/$f/done" ] && [ -e "/var/lib/ceph/mds/$f/upstart" ] && [ ! -e "/var/lib/ceph/mds/$f/sysvinit" ]; then
         cluster="${f%%-*}"
         id="${f#*-}"
         initctl emit ceph-mds cluster="$cluster" id="$id"
index b9664b62fedefa888f82c4cccce061a96f6c2a1e..9b9c8199cc64f2f54a79363d1b1f0a79ad31c363 100644 (file)
@@ -9,7 +9,7 @@ script
   # TODO what's the valid charset for cluster names and mon ids?
   find -L /var/lib/ceph/mon/ -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/mon/$f/done" ] && [ -e "/var/lib/ceph/mon/$f/upstart" ]; then
+    if [ -e "/var/lib/ceph/mon/$f/done" ] && [ -e "/var/lib/ceph/mon/$f/upstart" ] && [ ! -e "/var/lib/ceph/mon/$f/sysvinit" ]; then
         cluster="${f%%-*}"
         id="${f#*-}"
 
index 2e36dcceca63ba7d31d84f55c3e1a02e48c1b48a..94b99edb6228a611ea5069d7990cd2aab8a0b46a 100644 (file)
@@ -13,7 +13,7 @@ script
   # TODO what's the valid charset for cluster names and osd ids?
   find -L /var/lib/ceph/osd/ -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/osd/$f/ready" ] && [ -e "/var/lib/ceph/osd/$f/upstart" ]; then
+    if [ -e "/var/lib/ceph/osd/$f/ready" ] && [ -e "/var/lib/ceph/osd/$f/upstart" ] && [ ! -e "/var/lib/ceph/osd/$f/sysvinit" ]; then
         cluster="${f%%-*}"
         id="${f#*-}"
        initctl emit ceph-osd cluster="$cluster" id="$id"