From: Sage Weil Date: Fri, 27 Feb 2009 19:38:22 +0000 (-0800) Subject: ceph-daemons: add --allhosts option X-Git-Tag: v0.7~116 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=fb330f616803e739a4b6b34dd17ebdfbc176f9dc;p=ceph.git ceph-daemons: add --allhosts option By default only start hosts on the current host if 'host' is defined. If --allhosts is specified, ssh into the remote host to start/stop as needed. --- diff --git a/src/ceph-daemons b/src/ceph-daemons index 88bbf52653b3..dc7e0f108e66 100755 --- a/src/ceph-daemons +++ b/src/ceph-daemons @@ -32,6 +32,7 @@ localhost= debug= restartoncoredump= monaddr= +allhosts=0 while [[ $1 =~ '-' ]]; do # FIXME: why not '^-'? case $1 in @@ -50,6 +51,9 @@ case $1 in --restart) restartoncoredump=0 ;; + --allhosts) + allhosts=1; + ;; -m ) [ "$2" == "" ] && usage_exit options="$options $1" @@ -82,8 +86,29 @@ if [[ $what = "" ]]; then $CCONF -c $startup_conf -l osd | egrep -v '^osd$'` fi +hostname=`hostname | cut -d . -f 1` + for item in $what; do - + type=`echo $item | cut -c 1-3` + + # this host? + host=`$CCONF -c $startup_conf -s $item -s $type host` + ssh="" + if [[ $host != "" ]]; then + #echo host for $item is $host, i am $hostname + if [[ $host != $hostname ]]; then + # skip, unless we're starting remote daemons too + if [[ $allhosts -eq 0 ]]; then + continue; + fi + + # we'll need to ssh into that host + ssh="ssh root@$host" + fi + else + host=$hostname + fi + # extract item-specific options from $startup_conf echo asdf if [[ $item =~ "mon" ]]; then @@ -100,11 +125,11 @@ for item in $what; do case "$command" in start) - echo Starting ceph $item... + echo Starting ceph $item on $host... ;; stop) - echo Stopping ceph $item... + echo Stopping ceph $item on $host... ;; restart)