]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
sysvinit: fix enumeration of local daemons when specifying type only
authorSage Weil <sage@inktank.com>
Fri, 17 May 2013 03:37:05 +0000 (20:37 -0700)
committerSage Weil <sage@inktank.com>
Fri, 17 May 2013 03:39:32 +0000 (20:39 -0700)
- 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>
src/ceph_common.sh
src/init-ceph.in

index 188a5d537502a0bbe7e5c25947a0fe76b9848537..48354e41bfe06c85b76d91100c6995786ff52001 100644 (file)
@@ -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
index a9ee60b3280a8f72a09231b1b58c91af30a9ec0c..e8a71949995ed34adc8df5c522a9850532dcbff4 100644 (file)
@@ -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