]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
allow passing a --cluster flag to the init script
authorAlfredo Deza <alfredo.deza@inktank.com>
Thu, 7 Aug 2014 14:48:09 +0000 (10:48 -0400)
committerSage Weil <sage@redhat.com>
Tue, 12 Aug 2014 22:20:29 +0000 (15:20 -0700)
It will fallback to looking at /etc/ceph/$cluster.conf
otherwise.

Signed-off-by: Alfredo Deza <alfredo.deza@inktank.com>
(cherry picked from commit 23b4915fa252852cf02cc42a1b6143e2cd61b445)

src/init-ceph.in

index 45b56faa2a80e7f6290c9b50985e0abcf691e6be..529bfd38de6926f4d1d6413b1d2bf137aa6d920d 100644 (file)
@@ -31,6 +31,7 @@ fi
 usage_exit() {
     echo "usage: $0 [options] {start|stop|restart|condrestart} [mon|osd|mds]..."
     printf "\t-c ceph.conf\n"
+    printf "\t--cluster [cluster name]\tdefine the cluster name\n"
     printf "\t--valgrind\trun via valgrind\n"
     printf "\t--hostname [hostname]\toverride hostname lookup\n"
     exit
@@ -155,6 +156,12 @@ case $1 in
            shift
            conf=$1
            ;;
+    --cluster )
+           [ -z "$2" ] && usage_exit
+           options="$options $1"
+           shift
+           cluster=$1
+           ;;
     --hostname )
            [ -z "$2" ] && usage_exit
            options="$options $1"
@@ -189,7 +196,11 @@ fi
 for name in $what; do
     type=`echo $name | cut -c 1-3`   # e.g. 'mon', if $item is 'mon1'
     id=`echo $name | cut -c 4- | sed 's/^\\.//'`
-    cluster=`echo $conf | awk -F'/' '{print $(NF)}' | cut -d'.' -f 1`
+
+    # if `--cluster` was not passed in, fallback to looking at the config name
+    if ! [[ -n "$cluster" ]]; then
+        cluster=`echo $conf | awk -F'/' '{print $(NF)}' | cut -d'.' -f 1`
+    fi
     num=$id
     name="$type.$id"