From: Sage Weil Date: Fri, 17 May 2013 03:37:05 +0000 (-0700) Subject: sysvinit: fix enumeration of local daemons when specifying type only X-Git-Tag: v0.63~18 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c80c6a032c8112eab4f80a01ea18e1fa2c7aa6ed;p=ceph.git 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 Reviewed-by: Dan Mick --- diff --git a/src/ceph_common.sh b/src/ceph_common.sh index 188a5d537502..48354e41bfe0 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 a9ee60b3280a..e8a71949995e 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