init-ceph: ignore sections without 'host' defined

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>
This commit is contained in:
Sage Weil 2012-05-14 14:16:25 -07:00
parent 515649558d
commit 288635843a
2 changed files with 23 additions and 17 deletions

View 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 === "

View File

@ -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