diff options
author | Sage Weil <sage@inktank.com> | 2013-05-16 20:37:05 -0700 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-05-16 20:39:32 -0700 |
commit | c80c6a032c8112eab4f80a01ea18e1fa2c7aa6ed (patch) | |
tree | e4ffe2e09c932360ff860a5c8939db936db7bd43 | |
parent | d8d7113c35b59902902d487738888567e3a6b933 (diff) | |
download | ceph-c80c6a032c8112eab4f80a01ea18e1fa2c7aa6ed.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>
-rw-r--r-- | src/ceph_common.sh | 31 | ||||
-rw-r--r-- | src/init-ceph.in | 2 |
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 a9ee60b3280..e8a71949995 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 |