]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-daemons: generate list of items to stop/start in ceph_common.sh
authorSage Weil <sage@newdream.net>
Sat, 28 Feb 2009 00:17:40 +0000 (16:17 -0800)
committerSage Weil <sage@newdream.net>
Sat, 28 Feb 2009 00:17:40 +0000 (16:17 -0800)
nothing -> everything
mon -> all monitors (mon*)
mds0 -> just mds0

src/ceph-daemons
src/ceph_common.sh
src/mkcephfs

index c2d0fdd72c1819f48cc2d8f565d75298233cae40..93a28883867270f5eaa5c88be350d3ac434f9066 100755 (executable)
@@ -13,14 +13,6 @@ else
     ETCDIR=/etc/ceph
 fi
 
-CCONF="$BINDIR/cconf"
-conf=$ETCDIR"/startup.conf"
-cluster_conf=$ETCDIR"/cluster.conf"
-ARGS="-f"
-
-# get hostname, minus any domain
-hostname=`hostname | cut -d . -f 1`
-
 . $LIBDIR/ceph_common.sh
 
 usage_exit() {
@@ -100,14 +92,8 @@ done
 
 command=$1
 shift
-what="$@"
 
-if [[ $what = "" ]]; then
-    # extract list of monitors, mdss, osds defined in startup.conf
-    what=`$CCONF -c $conf -l mon | egrep -v '^mon$' ; \
-       $CCONF -c $conf -l mds | egrep -v '^mds$' ; \
-       $CCONF -c $conf -l osd | egrep -v '^osd$'`
-fi
+get_name_list "$@"
 
 for name in $what; do
     type=`echo $name | cut -c 1-3`   # e.g. 'mon', if $item is 'mon1'
@@ -119,7 +105,7 @@ for name in $what; do
     ssh=""
     cmd=""
     if [[ $host != "" ]]; then
-       #echo host for $name is $host, i am $hostname
+       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
@@ -164,7 +150,7 @@ for name in $what; do
     [[ $crun -eq 1 ]] && wrap="$BINDIR/crun"
 
     get_conf_bool valgrind "$dovalgrind" "valgrind" $sections
-    [[ $valgrind -eq 1]] && wrap="$wrap valgrind"
+    [[ $valgrind -eq 1 ]] && wrap="$wrap valgrind"
 
     [[ $wrap != "" ]] && runmode="-f &"
 
index 473fc781b5281eff705ec1b025d9290a1b433811..0639d5249d3d985af063f300555ca2ddabd5dd9e 100644 (file)
@@ -1,4 +1,38 @@
 
+CCONF="$BINDIR/cconf"
+
+conf=$ETCDIR"/startup.conf"
+cluster_conf=$ETCDIR"/cluster.conf"
+
+hostname=`hostname | cut -d . -f 1`
+
+
+get_name_list() {
+    orig=$1
+
+    if [[ $orig = "" ]]; then
+        # extract list of monitors, mdss, osds defined in startup.conf
+       what=`$CCONF -c $conf -l mon | egrep -v '^mon$' ; \
+           $CCONF -c $conf -l mds | egrep -v '^mds$' ; \
+           $CCONF -c $conf -l osd | egrep -v '^osd$'`
+       return
+    fi
+
+    what=""
+    for f in "$orig"; do
+       case $f in
+           mon | osd | mds)
+               bit=`$CCONF -c $conf -l $f | egrep -v "^$f$"`
+               what="$what $bit"
+               ;;
+           *)
+               what="$what $f"
+               ;;
+       esac
+    done
+}
+
+
 get_val() {
   [ "$2" != "" ] && export $1=$2 || export $1=`$CCONF -c $conf "$3" "$4" "$5"`
 }
index 9018fe5f10011785aa0904e4cd43768a2489acd9..47787a40c11cc4f53bd61d06c5d1e6d29760b17c 100755 (executable)
@@ -12,9 +12,6 @@ else
     ETCDIR=/etc/ceph
 fi
 
-CCONF="$BINDIR/cconf"
-conf=$ETCDIR"/cluster.conf"
-
 . $LIBDIR/ceph_common.sh
 
 usage_exit() {
@@ -55,18 +52,7 @@ esac
 shift
 done
 
-what=$*
-
-if [[ $what = "" ]]; then
-    # extract list of monitors, mdss, osds defined in startup.conf
-    what=`$CCONF -c $conf -l mon | egrep -v '^mon$' ; \
-       $CCONF -c $conf -l mds | egrep -v '^mds$' ; \
-       $CCONF -c $conf -l osd | egrep -v '^osd$'`
-fi
-
-# get hostname, minus any domain
-hostname=`hostname | cut -d . -f 1`
-
+get_name_list "$@"
 
 # create the monmap if we're doing mon0
 if [[ $what =~ "mon0" ]]; then