summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2013-05-16 20:37:05 -0700
committerSage Weil <sage@inktank.com>2013-05-22 13:55:25 -0700
commit48e1b11bcbdbdf8661cb560c8563f91738034287 (patch)
treec417cf9c8f6ac17334f59193e636877eb44b6c5b
parent6e5f0db75a2bf591bd1fc0a5c2a93051f83ebc5d (diff)
downloadceph-48e1b11bcbdbdf8661cb560c8563f91738034287.tar.gz
sysvinit: fix enumeration of local daemons when specifying type only
- prepend $local to the $allconf list at the top - remove $local special case for all case - fix the type prefix checks to explicitly check for prefixes Fugly bash, but works! Backport: cuttlefish, bobtail Signed-off-by: Sage Weil <sage@inktank.com> Reviewed-by: Dan Mick <dan.mick@inktank.com> (cherry picked from commit c80c6a032c8112eab4f80a01ea18e1fa2c7aa6ed)
-rw-r--r--src/ceph_common.sh31
-rw-r--r--src/init-ceph.in2
2 files changed, 12 insertions, 21 deletions
diff --git a/src/ceph_common.sh b/src/ceph_common.sh
index 188a5d53750..48354e41bfe 100644
--- a/src/ceph_common.sh
+++ b/src/ceph_common.sh
@@ -146,36 +146,23 @@ get_local_daemon_list() {
}
get_local_name_list() {
- orig=$1
+ # enumerate local directories
local=""
-
- if [ -z "$orig" ]; then
- # enumerate local directories
- get_local_daemon_list "mon"
- get_local_daemon_list "osd"
- get_local_daemon_list "mds"
- return
- fi
-
- for f in $orig; do
- type=`echo $f | cut -c 1-3` # e.g. 'mon', if $item is 'mon1'
- id=`echo $f | cut -c 4- | sed 's/\\.//'`
- get_local_daemon_list $type
-
- # FIXME
- done
+ get_local_daemon_list "mon"
+ get_local_daemon_list "osd"
+ get_local_daemon_list "mds"
}
get_name_list() {
orig="$*"
# extract list of monitors, mdss, osds defined in startup.conf
- allconf=`$CCONF -c $conf -l mon | egrep -v '^mon$' || true ; \
+ allconf="$local "`$CCONF -c $conf -l mon | egrep -v '^mon$' || true ; \
$CCONF -c $conf -l mds | egrep -v '^mds$' || true ; \
$CCONF -c $conf -l osd | egrep -v '^osd$' || true`
if [ -z "$orig" ]; then
- what="$allconf $local"
+ what="$allconf"
return
fi
@@ -185,7 +172,11 @@ get_name_list() {
id=`echo $f | cut -c 4- | sed 's/\\.//'`
case $f in
mon | osd | mds)
- what="$what "`echo "$allconf" "$local" | grep ^$type || true`
+ for d in $allconf; do
+ if echo $d | grep -q ^$type; then
+ what="$what $d"
+ fi
+ done
;;
*)
if ! echo " " $allconf $local " " | egrep -q "( $type$id | $type.$id )"; then
diff --git a/src/init-ceph.in b/src/init-ceph.in
index c922eb3078b..88fe6eb7d36 100644
--- a/src/init-ceph.in
+++ b/src/init-ceph.in
@@ -167,7 +167,7 @@ verify_conf
command=$1
[ -n "$*" ] && shift
-get_local_name_list "$@"
+get_local_name_list
get_name_list "$@"
for name in $what; do