]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mkcephfs: allow a prebuild osdmap to be specified
authorSage Weil <sage.weil@dreamhost.com>
Tue, 19 Apr 2011 21:13:02 +0000 (14:13 -0700)
committerSage Weil <sage.weil@dreamhost.com>
Tue, 19 Apr 2011 21:13:02 +0000 (14:13 -0700)
Otherwise we'll create one with osdmaptool --createsimple with the default
generic settins.

Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
src/mkcephfs.in

index 40a1cf90596d550b126c2d1a72a0272dc44dac86..f0cdcd2208ab9c85780cf5405ec8862424b1c031 100644 (file)
@@ -77,6 +77,7 @@ initdaemons=""
 preparemon=0
 
 numosd=
+useosdmap=
 usecrushmapsrc=
 usecrushmap=
 verbose=0
@@ -133,6 +134,12 @@ case $1 in
            numosd=$1
            moreargs="$moreargs --numosd $1"
            ;;
+    --osdmap)
+           [ -z "$2" ] && usage_exit
+           shift
+           useosdmap=$1
+           moreargs="$moreargs --osdmap $1"
+           ;;
     --crushmapsrc)
            [ -z "$2" ] && usage_exit
            shift
@@ -287,20 +294,26 @@ fi
 ### prepare-mon ###
 
 if [ $preparemon -eq 1 ]; then
-    # build osdmap
-    echo "Building osdmap"
 
-    # find highest osd id - assumes the conf file complies with osd numbering requirements
-    maxosd=`$CCONF -c $conf -l osd | grep -v ^osd\$ | cut -c 5- | sort -n | tail -1`
-    echo " highest numbered osd in $conf is osd.$maxosd"
-    lastosd=$(($maxosd + 1))
+    if [ -n "$useosdmap" ]; then
+       echo "Using osdmap $useosdmap"
+       cp $useosdmap $dir/osdmap
+    else
+        # build osdmap
+       echo "Building generic osdmap"
 
-    if [ -z "$numosd" ]; then
-       get_conf numosd "$lastosd" "num osd" mon global
-    fi
-    echo " num osd = $numosd"
+        # find highest osd id - assumes the conf file complies with osd numbering requirements
+       maxosd=`$CCONF -c $conf -l osd | grep -v ^osd\$ | cut -c 5- | sort -n | tail -1`
+       echo " highest numbered osd in $conf is osd.$maxosd"
+       lastosd=$(($maxosd + 1))
 
-    $BINDIR/osdmaptool --createsimple $numosd $dir/osdmap
+       if [ -z "$numosd" ]; then
+           get_conf numosd "$lastosd" "num osd" mon global
+       fi
+       echo " num osd = $numosd"
+
+       $BINDIR/osdmaptool --createsimple $numosd $dir/osdmap
+    fi
 
     # import crush map?
     get_conf crushmapsrc "" "crush map src" mon global
@@ -414,7 +427,6 @@ if [ $allhosts -eq 1 ]; then
     $0 -d $dir --prepare-mon $moreargs
     
     # mons
-
     get_name_list "mon"
     for name in $what; do
        type=`echo $name | cut -c 1-3`   # e.g. 'mon', if $name is 'mon1'