#BUILT_SOURCES += libhadoopcephfs.so
-
+# shell scripts
+editpaths = sed \
+ -e 's|@bindir[@]|$(bindir)|g' \
+ -e 's|@libdir[@]|$(libdir)|g' \
+ -e 's|@sysconfdir[@]|$(sysconfdir)|g' \
+ -e 's|@datadir[@]|$(pkgdatadir)|g' \
+ -e 's|@prefix[@]|$(prefix)|g'
+
+init-ceph mkcephfs: init-ceph.in mkcephfs.in Makefile
+ rm -f $@ $@.tmp
+ $(editpaths) '$(srcdir)/$@.in' >$@.tmp
+ chmod +x $@.tmp
+ chmod a-w $@.tmp
+ mv $@.tmp $@
+
+BUILT_SOURCES += init-ceph mkcephfs
##
INCLUDES =
ceph_ver.c : ceph_ver.h
+
+
# cleaning
clean-local:
-rm *.so
conf=$ETCDIR"/ceph.conf"
hostname=`hostname | cut -d . -f 1`
+figure_dirs() {
+ if echo $bindir | grep -q \@; then
+ echo "using current dir"
+ BINDIR=.
+ LIBDIR=.
+ ETCDIR=.
+ else
+ echo "all good"
+
+ fi
+}
verify_conf() {
# make sure ceph.conf exists
+++ /dev/null
-#!/bin/sh
-# Start/stop ceph daemons
-
-### BEGIN INIT INFO
-# Provides: ceph
-# Default-Start: 2 3 4 5
-# Default-Stop: 0 1 6
-# Required-Start: $local_fs $named $network $time
-# Required-Stop: $local_fs $named $network $time
-# Short-Description: Start Ceph distributed file system daemons at boot time
-# Description: Enable Ceph distributed file system services.
-### END INIT INFO
-
-# if we start up as ./init-ceph, assume everything else is in the
-# current directory too.
-if [ `dirname $0` = "." ] && [ $PWD != "/etc/init.d" ]; then
- BINDIR=.
- LIBDIR=.
- ETCDIR=.
-else
- BINDIR=/usr/bin
- LIBDIR=/usr/lib/ceph
- ETCDIR=/etc/ceph
-fi
-
-usage_exit() {
- echo "usage: $0 [options] {start|stop|restart} [mon|osd|mds]..."
- printf "\t-c ceph.conf\n"
- printf "\t--valgrind\trun via valgrind\n"
- exit
-}
-
-. $LIBDIR/ceph_common.sh
-
-
-stop_daemon() {
- name=$1
- daemon=$2
- pidfile=$3
- signal=$4
- action=$5
- [ -z "$action" ] && action="Stopping"
- echo -n "$action ceph $name on $host..."
- do_cmd "while [ 1 ]; do
- [ -e $pidfile ] || break
- pid=\`cat $pidfile\`
- while [ -e /proc/\$pid ] && grep -q $daemon /proc/\$pid/cmdline ; do
- cmd=\"kill $signal \$pid\"
- echo -n \$cmd...
- \$cmd
- sleep 1
- continue
- done
- break
- done"
- echo done
-}
-
-## command line options
-options=
-
-version=0
-dovalgrind=
-docrun=
-allhosts=0
-debug=0
-monaddr=
-dobtrfs=1
-verbose=0
-
-while echo $1 | grep -q '^-'; do # FIXME: why not '^-'?
-case $1 in
- -v | --verbose)
- verbose=1
- ;;
- --valgrind)
- dovalgrind=1
- ;;
- --novalgrind)
- dovalgrind=0
- ;;
- --allhosts | -a)
- allhosts=1;
- ;;
- --restart)
- docrun=1
- ;;
- --norestart)
- docrun=0
- ;;
- -m )
- [ "$2" == "" ] && usage_exit
- options="$options $1"
- shift
- MON_ADDR=$1
- ;;
- --btrfs)
- dobtrfs=1
- ;;
- --nobtrfs)
- dobtrfs=0
- ;;
- --conf | -c)
- [ "$2" == "" ] && usage_exit
- options="$options $1"
- shift
- conf=$1
- ;;
- *)
- echo unrecognized option \'$1\'
- usage_exit
- ;;
-esac
-options="$options $1"
-shift
-done
-
-verify_conf
-
-command=$1
-shift
-
-get_name_list "$@"
-
-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/\\.//'`
- num=$id
-
- check_host || continue
-
- cmd="$BINDIR/c$type -i $id"
-
- # conf file
- if [ "$host" = "$hostname" ]; then
- cmd="$cmd -c $conf"
- else
- if echo $pushed_to | grep -v -q " $host "; then
- scp -q $conf $host:/tmp/ceph.conf.$$
- pushed_to="$pushed_to $host "
- fi
- cmd="$cmd -c /tmp/ceph.conf.$$"
- fi
-
- if echo $name | grep -q ^osd; then
- get_conf osd_data "" "osd data"
- get_conf btrfs_path "$osd_data" "btrfs path" # mount point defaults so osd data
- get_conf btrfs_devs "" "btrfs devs"
- first_dev=`echo $btrfs_devs | cut '-d ' -f 1`
- fi
-
- get_conf pid_file "" "pid file"
-
- case "$command" in
- start)
- # build final command
- wrap=""
- runmode=""
- runarg=""
-
- [ -z "$crun" ] && get_conf_bool crun "0" "restart on core dump"
- [ "$crun" -eq 1 ] && wrap="$BINDIR/crun"
-
- [ -z "$dovalgrind" ] && get_conf_bool valgrind "" "valgrind"
- [ -n "$valgrind" ] && wrap="$wrap valgrind $valgrind"
-
- [ -n "$wrap" ] && runmode="-f &" && runarg="-f"
-
- cmd="$wrap $cmd $runmode"
-
- echo Starting ceph $name on $host...
- if [ $dobtrfs -eq 1 ] && [ -n "$btrfs_devs" ]; then
- get_conf pre_mount "true" "pre mount command"
- get_conf btrfs_opt "flushoncommit" "btrfs options"
- [ -n "$btrfs_opt" ] && btrfs_opt="-o $btrfs_opt"
- [ -n "$pre_mount" ] && do_cmd $pre_mount
- do_root_cmd "modprobe btrfs ; btrfsctl -a ; egrep -q '^[^ ]+ $btrfs_path' /proc/mounts || mount -t btrfs $btrfs_opt $first_dev $btrfs_path"
- fi
- get_conf pre_start_eval "" "pre start eval"
- [ -n "$pre_start_eval" ] && $pre_start_eval
- get_conf pre_start "" "pre start command"
- get_conf post_start "" "post start command"
- [ -n "$pre_start" ] && do_cmd $pre_start
- do_cmd "$cmd" $runarg
- [ -n "$post_start" ] && do_cmd $post_start
- ;;
-
- stop)
- get_conf pre_stop "" "pre stop command"
- get_conf post_stop "" "post stop command"
- [ -n "$pre_stop" ] && do_cmd $pre_stop
- stop_daemon $name c$type $pid_file
- [ -n "$post_stop" ] && do_cmd $post_stop
- ;;
-
- forcestop)
- get_conf pre_forcestop "" "pre forcestop command"
- get_conf post_forcestop "" "post forcestop command"
- [ -n "$pre_forcestop" ] && do_cmd $pre_forcestop
- stop_daemon $name c$type $pid_file -9
- [ -n "$post_forcestop" ] && do_cmd $post_forcestop
- ;;
-
- killall)
- echo "killall c$type on $host"
- do_cmd "killall -9 c$type || true"
- ;;
-
- force-reload | reload)
- stop_daemon $name c$type $pid_file -1 "Reloading"
- ;;
-
- restart)
- $0 $options stop $name
- $0 $options start $name
- ;;
-
- cleanlogs)
- echo removing logs
- get_conf log_dir "/var/log/ceph" "log dir"
- get_conf log_sym_dir "/var/log/ceph" "log sym dir"
- do_cmd "for f in $log_sym_dir/$name*; do rm -f \`readlink \$f\` ; rm -f \$f ; done"
- ;;
-
- cleanalllogs)
- echo removing all logs
- get_conf log_dir "/var/log/ceph" "log dir"
- get_conf log_sym_dir "/var/log/ceph" "log sym dir"
- do_cmd "rm -f $log_dir/* $log_sym_dir/* || true"
- ;;
-
- *)
- usage_exit
- ;;
- esac
-done
-
-exit 0
--- /dev/null
+#!/bin/sh
+# Start/stop ceph daemons
+
+### BEGIN INIT INFO
+# Provides: ceph
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Required-Start: $local_fs $named $network $time
+# Required-Stop: $local_fs $named $network $time
+# Short-Description: Start Ceph distributed file system daemons at boot time
+# Description: Enable Ceph distributed file system services.
+### END INIT INFO
+
+# if we start up as ./mkcephfs, assume everything else is in the
+# current directory too.
+if [ `dirname $0` = "." ] && [ $PWD != "/etc/init.d" ]; then
+ BINDIR=.
+ LIBDIR=.
+ ETCDIR=.
+else
+ BINDIR=@bindir@
+ LIBDIR=@libdir@/ceph
+ ETCDIR=@sysconfdir@/ceph
+fi
+
+usage_exit() {
+ echo "usage: $0 [options] {start|stop|restart} [mon|osd|mds]..."
+ printf "\t-c ceph.conf\n"
+ printf "\t--valgrind\trun via valgrind\n"
+ exit
+}
+
+. $LIBDIR/ceph_common.sh
+
+
+stop_daemon() {
+ name=$1
+ daemon=$2
+ pidfile=$3
+ signal=$4
+ action=$5
+ [ -z "$action" ] && action="Stopping"
+ echo -n "$action ceph $name on $host..."
+ do_cmd "while [ 1 ]; do
+ [ -e $pidfile ] || break
+ pid=\`cat $pidfile\`
+ while [ -e /proc/\$pid ] && grep -q $daemon /proc/\$pid/cmdline ; do
+ cmd=\"kill $signal \$pid\"
+ echo -n \$cmd...
+ \$cmd
+ sleep 1
+ continue
+ done
+ break
+ done"
+ echo done
+}
+
+## command line options
+options=
+
+version=0
+dovalgrind=
+docrun=
+allhosts=0
+debug=0
+monaddr=
+dobtrfs=1
+verbose=0
+
+while echo $1 | grep -q '^-'; do # FIXME: why not '^-'?
+case $1 in
+ -v | --verbose)
+ verbose=1
+ ;;
+ --valgrind)
+ dovalgrind=1
+ ;;
+ --novalgrind)
+ dovalgrind=0
+ ;;
+ --allhosts | -a)
+ allhosts=1;
+ ;;
+ --restart)
+ docrun=1
+ ;;
+ --norestart)
+ docrun=0
+ ;;
+ -m )
+ [ "$2" == "" ] && usage_exit
+ options="$options $1"
+ shift
+ MON_ADDR=$1
+ ;;
+ --btrfs)
+ dobtrfs=1
+ ;;
+ --nobtrfs)
+ dobtrfs=0
+ ;;
+ --conf | -c)
+ [ "$2" == "" ] && usage_exit
+ options="$options $1"
+ shift
+ conf=$1
+ ;;
+ *)
+ echo unrecognized option \'$1\'
+ usage_exit
+ ;;
+esac
+options="$options $1"
+shift
+done
+
+verify_conf
+
+command=$1
+shift
+
+get_name_list "$@"
+
+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/\\.//'`
+ num=$id
+
+ check_host || continue
+
+ cmd="$BINDIR/c$type -i $id"
+
+ # conf file
+ if [ "$host" = "$hostname" ]; then
+ cmd="$cmd -c $conf"
+ else
+ if echo $pushed_to | grep -v -q " $host "; then
+ scp -q $conf $host:/tmp/ceph.conf.$$
+ pushed_to="$pushed_to $host "
+ fi
+ cmd="$cmd -c /tmp/ceph.conf.$$"
+ fi
+
+ if echo $name | grep -q ^osd; then
+ get_conf osd_data "" "osd data"
+ get_conf btrfs_path "$osd_data" "btrfs path" # mount point defaults so osd data
+ get_conf btrfs_devs "" "btrfs devs"
+ first_dev=`echo $btrfs_devs | cut '-d ' -f 1`
+ fi
+
+ get_conf pid_file "" "pid file"
+
+ case "$command" in
+ start)
+ # build final command
+ wrap=""
+ runmode=""
+ runarg=""
+
+ [ -z "$crun" ] && get_conf_bool crun "0" "restart on core dump"
+ [ "$crun" -eq 1 ] && wrap="$BINDIR/crun"
+
+ [ -z "$dovalgrind" ] && get_conf_bool valgrind "" "valgrind"
+ [ -n "$valgrind" ] && wrap="$wrap valgrind $valgrind"
+
+ [ -n "$wrap" ] && runmode="-f &" && runarg="-f"
+
+ cmd="$wrap $cmd $runmode"
+
+ echo Starting ceph $name on $host...
+ if [ $dobtrfs -eq 1 ] && [ -n "$btrfs_devs" ]; then
+ get_conf pre_mount "true" "pre mount command"
+ get_conf btrfs_opt "flushoncommit" "btrfs options"
+ [ -n "$btrfs_opt" ] && btrfs_opt="-o $btrfs_opt"
+ [ -n "$pre_mount" ] && do_cmd $pre_mount
+ do_root_cmd "modprobe btrfs ; btrfsctl -a ; egrep -q '^[^ ]+ $btrfs_path' /proc/mounts || mount -t btrfs $btrfs_opt $first_dev $btrfs_path"
+ fi
+ get_conf pre_start_eval "" "pre start eval"
+ [ -n "$pre_start_eval" ] && $pre_start_eval
+ get_conf pre_start "" "pre start command"
+ get_conf post_start "" "post start command"
+ [ -n "$pre_start" ] && do_cmd $pre_start
+ do_cmd "$cmd" $runarg
+ [ -n "$post_start" ] && do_cmd $post_start
+ ;;
+
+ stop)
+ get_conf pre_stop "" "pre stop command"
+ get_conf post_stop "" "post stop command"
+ [ -n "$pre_stop" ] && do_cmd $pre_stop
+ stop_daemon $name c$type $pid_file
+ [ -n "$post_stop" ] && do_cmd $post_stop
+ ;;
+
+ forcestop)
+ get_conf pre_forcestop "" "pre forcestop command"
+ get_conf post_forcestop "" "post forcestop command"
+ [ -n "$pre_forcestop" ] && do_cmd $pre_forcestop
+ stop_daemon $name c$type $pid_file -9
+ [ -n "$post_forcestop" ] && do_cmd $post_forcestop
+ ;;
+
+ killall)
+ echo "killall c$type on $host"
+ do_cmd "killall -9 c$type || true"
+ ;;
+
+ force-reload | reload)
+ stop_daemon $name c$type $pid_file -1 "Reloading"
+ ;;
+
+ restart)
+ $0 $options stop $name
+ $0 $options start $name
+ ;;
+
+ cleanlogs)
+ echo removing logs
+ get_conf log_dir "/var/log/ceph" "log dir"
+ get_conf log_sym_dir "/var/log/ceph" "log sym dir"
+ do_cmd "for f in $log_sym_dir/$name*; do rm -f \`readlink \$f\` ; rm -f \$f ; done"
+ ;;
+
+ cleanalllogs)
+ echo removing all logs
+ get_conf log_dir "/var/log/ceph" "log dir"
+ get_conf log_sym_dir "/var/log/ceph" "log sym dir"
+ do_cmd "rm -f $log_dir/* $log_sym_dir/* || true"
+ ;;
+
+ *)
+ usage_exit
+ ;;
+ esac
+done
+
+exit 0
+++ /dev/null
-#!/bin/sh
-
-# if we start up with "./", assume everything else is in the current
-# directory too.
-if [ `dirname $0` = "." ] && [ $PWD != "/usr/sbin" ]; then
- BINDIR=.
- LIBDIR=.
- ETCDIR=.
-else
- BINDIR=/usr/bin
- LIBDIR=/usr/lib/ceph
- ETCDIR=/etc/ceph
-fi
-
-usage_exit() {
- echo "usage: $0 [--allhosts] [-c ceph.conf] [--clobber_old_data] [--mkbtrfs]"
- exit
-}
-
-. $LIBDIR/ceph_common.sh
-
-
-allhosts=0
-clobber=""
-mkbtrfs=0
-numosd=
-usecrushmapsrc=
-usecrushmap=
-verbose=0
-
-while [ $# -ge 1 ]; do
-case $1 in
- -v )
- verbose=1;
- ;;
- --allhosts | -a)
- allhosts=1
- ;;
- --clobber_old_data)
- clobber="--clobber"
- ;;
- --mkbtrfs)
- mkbtrfs=1
- ;;
- --conf | -c)
- [ "$2" = "" ] && usage_exit
- shift
- conf=$1
- ;;
- --numosd)
- [ "$2" = "" ] && usage_exit
- shift
- numosd=$1
- ;;
- --crushmapsrc)
- [ "$2" = "" ] && usage_exit
- shift
- usecrushmapsrc=$1
- ;;
- --crushmap)
- [ "$2" = "" ] && usage_exit
- shift
- usecrushmap=$1
- ;;
- *)
- echo unrecognized option \'$1\'
- usage_exit
- ;;
-esac
-shift
-done
-
-verify_conf
-
-get_name_list "$@"
-
-# create the monmap if we're doing mon0
-if echo $what | grep -q mon0 ; then
- # first, make a list of monitors
- mons=`$CCONF -c $conf -l mon | egrep -v '^mon$' | sort`
- args=""
-
- type="mon"
- for name in $mons; do
- id=`echo $name | cut -c 4- | sed 's/\\.//'`
- get_conf addr "" "mon addr"
- args=$args" --add $addr"
- done
-
- # build monmap
- monmap="/tmp/monmap.$$"
- echo $BINDIR/monmaptool --create --clobber $args --print $monmap || exit 1
- $BINDIR/monmaptool --create --clobber $args --print $monmap || exit 1
-
- # build osdmap
- osdmap="/tmp/osdmap.$$"
- if [ -z "$numosd" ]; then
- maxosd=`$CCONF -c $conf -l osd | egrep -v '^osd$' | tail -1 | cut -c 4-`
- numosd=$(($maxosd + 1))
- echo max osd in $conf is $maxosd, num osd is $numosd
- fi
- $BINDIR/osdmaptool --clobber --createsimple $numosd $osdmap || exit 1
-
- # import crush map?
- get_conf crushmapsrc "$usecrushmapsrc" "crush map src" mon0 mon global
- if [ -n "$crushmapsrc" ]; then
- echo Compiling crush map from $crushmapsrc to $crushmap
- crushmap="/tmp/crushmap.$$"
- $BINDIR/crushtool -c $crushmapsrc -o $crushmap
- fi
- get_conf crushmap "$usecrushmap" "crush map" mon0 mon global
- if [ -n "$crushmap" ]; then
- echo Importing crush map from $crushmap
- $BINDIR/osdmaptool --clobber --import-crush $crushmap $osdmap
- fi
-fi
-
-# create monitors, osds
-for name in $what; do
- type=`echo $name | cut -c 1-3` # e.g. 'mon', if $name is 'mon1'
- id=`echo $name | cut -c 4- | sed 's/\\.//'`
- num=$id
-
- check_host || continue
-
- if [ -n "$ssh" ] && ( echo $pushed_to | grep -v -q " $host " ); then
- scp -q $osdmap $host:$osdmap
- scp -q $monmap $host:$monmap
- pushed_to="$pushed_to $host "
- fi
-
- if [ "$type" = "mon" ]; then
- get_conf mon_data "" "mon data"
- do_cmd "$BINDIR/mkmonfs $clobber --mon-data $mon_data -i $num --monmap $monmap --osdmap $osdmap"
- fi
-
- if [ "$type" = "osd" ]; then
- get_conf osd_data "" "osd data"
- get_conf btrfs_path "$osd_data" "btrfs path" # mount point defaults so osd data
- get_conf btrfs_devs "" "btrfs devs"
- first_dev=`echo $btrfs_devs | cut '-d ' -f 1`
- get_conf btrfs_opt "flushoncommit" "btrfs options"
- [ -n "$btrfs_opt" ] && btrfs_opt="-o $btrfs_opt"
-
- do_cmd "test -d $osd_data || mkdir -p $osd_data"
-
- if [ $mkbtrfs -eq 1 ]; then
- do_root_cmd "umount $btrfs_path ; for f in $btrfs_devs ; do umount \$f ; done ; modprobe btrfs ; mkfs.btrfs $btrfs_devs ; modprobe btrfs ; btrfsctl -a ; mount -t btrfs $btrfs_opt $first_dev $btrfs_path"
- fi
-
- [ -n "$ssh" ] && scp $monmap $host:$monmap
- do_cmd "$BINDIR/cosd -c $conf --monmap $monmap -i $num --mkfs --osd-data $osd_data"
- fi
-
- if [ "$type" = "mds" ]; then
- # do nothing
- echo
- fi
-
-done
--- /dev/null
+#!/bin/sh
+
+# if we start up as ./init-ceph, assume everything else is in the
+# current directory too.
+if [ `dirname $0` = "." ] && [ $PWD != "/etc/init.d" ]; then
+ BINDIR=.
+ LIBDIR=.
+ ETCDIR=.
+else
+ BINDIR=@bindir@
+ LIBDIR=@libdir@/ceph
+ ETCDIR=@sysconfdir@/ceph
+fi
+
+usage_exit() {
+ echo "usage: $0 [--allhosts] [-c ceph.conf] [--clobber_old_data] [--mkbtrfs]"
+ exit
+}
+
+. $LIBDIR/ceph_common.sh
+
+
+allhosts=0
+clobber=""
+mkbtrfs=0
+numosd=
+usecrushmapsrc=
+usecrushmap=
+verbose=0
+
+while [ $# -ge 1 ]; do
+case $1 in
+ -v )
+ verbose=1;
+ ;;
+ --allhosts | -a)
+ allhosts=1
+ ;;
+ --clobber_old_data)
+ clobber="--clobber"
+ ;;
+ --mkbtrfs)
+ mkbtrfs=1
+ ;;
+ --conf | -c)
+ [ "$2" = "" ] && usage_exit
+ shift
+ conf=$1
+ ;;
+ --numosd)
+ [ "$2" = "" ] && usage_exit
+ shift
+ numosd=$1
+ ;;
+ --crushmapsrc)
+ [ "$2" = "" ] && usage_exit
+ shift
+ usecrushmapsrc=$1
+ ;;
+ --crushmap)
+ [ "$2" = "" ] && usage_exit
+ shift
+ usecrushmap=$1
+ ;;
+ *)
+ echo unrecognized option \'$1\'
+ usage_exit
+ ;;
+esac
+shift
+done
+
+verify_conf
+
+get_name_list "$@"
+
+# create the monmap if we're doing mon0
+if echo $what | grep -q mon0 ; then
+ # first, make a list of monitors
+ mons=`$CCONF -c $conf -l mon | egrep -v '^mon$' | sort`
+ args=""
+
+ type="mon"
+ for name in $mons; do
+ id=`echo $name | cut -c 4- | sed 's/\\.//'`
+ get_conf addr "" "mon addr"
+ args=$args" --add $addr"
+ done
+
+ # build monmap
+ monmap="/tmp/monmap.$$"
+ echo $BINDIR/monmaptool --create --clobber $args --print $monmap || exit 1
+ $BINDIR/monmaptool --create --clobber $args --print $monmap || exit 1
+
+ # build osdmap
+ osdmap="/tmp/osdmap.$$"
+ if [ -z "$numosd" ]; then
+ maxosd=`$CCONF -c $conf -l osd | egrep -v '^osd$' | tail -1 | cut -c 4-`
+ numosd=$(($maxosd + 1))
+ echo max osd in $conf is $maxosd, num osd is $numosd
+ fi
+ $BINDIR/osdmaptool --clobber --createsimple $numosd $osdmap || exit 1
+
+ # import crush map?
+ get_conf crushmapsrc "$usecrushmapsrc" "crush map src" mon0 mon global
+ if [ -n "$crushmapsrc" ]; then
+ echo Compiling crush map from $crushmapsrc to $crushmap
+ crushmap="/tmp/crushmap.$$"
+ $BINDIR/crushtool -c $crushmapsrc -o $crushmap
+ fi
+ get_conf crushmap "$usecrushmap" "crush map" mon0 mon global
+ if [ -n "$crushmap" ]; then
+ echo Importing crush map from $crushmap
+ $BINDIR/osdmaptool --clobber --import-crush $crushmap $osdmap
+ fi
+fi
+
+# create monitors, osds
+for name in $what; do
+ type=`echo $name | cut -c 1-3` # e.g. 'mon', if $name is 'mon1'
+ id=`echo $name | cut -c 4- | sed 's/\\.//'`
+ num=$id
+
+ check_host || continue
+
+ if [ -n "$ssh" ] && ( echo $pushed_to | grep -v -q " $host " ); then
+ scp -q $osdmap $host:$osdmap
+ scp -q $monmap $host:$monmap
+ pushed_to="$pushed_to $host "
+ fi
+
+ if [ "$type" = "mon" ]; then
+ get_conf mon_data "" "mon data"
+ do_cmd "$BINDIR/mkmonfs $clobber --mon-data $mon_data -i $num --monmap $monmap --osdmap $osdmap"
+ fi
+
+ if [ "$type" = "osd" ]; then
+ get_conf osd_data "" "osd data"
+ get_conf btrfs_path "$osd_data" "btrfs path" # mount point defaults so osd data
+ get_conf btrfs_devs "" "btrfs devs"
+ first_dev=`echo $btrfs_devs | cut '-d ' -f 1`
+ get_conf btrfs_opt "flushoncommit" "btrfs options"
+ [ -n "$btrfs_opt" ] && btrfs_opt="-o $btrfs_opt"
+
+ do_cmd "test -d $osd_data || mkdir -p $osd_data"
+
+ if [ $mkbtrfs -eq 1 ]; then
+ do_root_cmd "umount $btrfs_path ; for f in $btrfs_devs ; do umount \$f ; done ; modprobe btrfs ; mkfs.btrfs $btrfs_devs ; modprobe btrfs ; btrfsctl -a ; mount -t btrfs $btrfs_opt $first_dev $btrfs_path"
+ fi
+
+ [ -n "$ssh" ] && scp $monmap $host:$monmap
+ do_cmd "$BINDIR/cosd -c $conf --monmap $monmap -i $num --mkfs --osd-data $osd_data"
+ fi
+
+ if [ "$type" = "mds" ]; then
+ # do nothing
+ echo
+ fi
+
+done