]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
init-ceph: ignore sections without 'host' defined
authorSage Weil <sage@inktank.com>
Mon, 14 May 2012 21:16:25 +0000 (14:16 -0700)
committerSage Weil <sage@inktank.com>
Wed, 16 May 2012 23:36:52 +0000 (16:36 -0700)
This will make it easier for sysvinit and upstart to coexist.

We will break existing users who have a separate .conf for each node and
didn't add host lines.  We'll need to make note of that in the release
notes.

Fixes: #2404
Signed-off-by: Sage Weil <sage@inktank.com>
src/ceph_common.sh
src/vstart.sh

index eb1f4e36a8e7517b4c1be614a721ee8c93eaccc2..62c28ffffd42d22c9440d8c4275462a17ab62d61 100644 (file)
@@ -39,25 +39,28 @@ check_host() {
     rootssh=""
     sshdir=$PWD
     get_conf user "" "user"
-    if [ -n "$host" ]; then
-       #echo host for $name is $host, i am $hostname
-       if [ "$host" != "$hostname" ]; then
-           # skip, unless we're starting remote daemons too
-           if [ $allhosts -eq 0 ]; then
-               return 1
-           fi
 
-           # we'll need to ssh into that host
-           if [ -z "$user" ]; then
-               ssh="ssh $host"
-           else
-               ssh="ssh $user@$host"
-           fi
-           rootssh="ssh root@$host"
-           get_conf sshdir "$sshdir" "ssh path"
+    #echo host for $name is $host, i am $hostname
+
+    # ignore all sections without 'host' defined
+    if [ -z "$host" ]; then
+       return 1
+    fi
+
+    if [ "$host" != "$hostname" ]; then
+       # skip, unless we're starting remote daemons too
+       if [ $allhosts -eq 0 ]; then
+           return 1
        fi
-    else
-       host=$hostname
+
+       # we'll need to ssh into that host
+       if [ -z "$user" ]; then
+           ssh="ssh $host"
+       else
+           ssh="ssh $user@$host"
+       fi
+       rootssh="ssh root@$host"
+       get_conf sshdir "$sshdir" "ssh path"
     fi
 
     echo "=== $type.$id === "
index 5b0cb14b7aae8040c11ab173701772d9090d5670..02dfc230d0ea99fd495dacdf85ddceae0c46ebde 100755 (executable)
@@ -314,6 +314,7 @@ EOF
                        if [ $overwrite_conf -eq 1 ]; then
                                cat <<EOF >> $conf
 [mon.$f]
+        host = $HOSTNAME
         mon data = dev/mon.$f
         mon addr = $IP:$(($CEPH_PORT+$count))
 EOF
@@ -352,6 +353,7 @@ if [ "$start_osd" -eq 1 ]; then
            if [ $overwrite_conf -eq 1 ]; then
                    cat <<EOF >> $conf
 [osd.$osd]
+        host = $HOSTNAME
         osd data = dev/osd$osd
         osd journal = dev/osd$osd.journal
         osd journal size = 100
@@ -396,6 +398,7 @@ if [ "$start_mds" -eq 1 ]; then
            if [ $overwrite_conf -eq 1 ]; then
                cat <<EOF >> $conf
 [mds.$name]
+        host = $HOSTNAME
 EOF
                if [ "$cephx" -eq 1 ]; then
                    cat <<EOF >> $conf