CEPH_NUM_MDS="$MDS"
RGW=`$CEPH_BIN/ceph-conf -c $conf_fn --name $VSTART_SEC num_rgw 2>/dev/null` && \
CEPH_NUM_RGW="$RGW"
+else
+ rm -- "$conf_fn"
fi
if [ "$start_all" -eq 1 ]; then
fi
}
+wconf() {
+ if [ "$overwrite_conf" -eq 1 ]; then
+ cat >> "$conf_fn"
+ fi
+}
+
if [ "$debug" -eq 0 ]; then
CMONDEBUG='
debug mon = 10
if [ "$start_mon" -eq 1 ]; then
-
if [ "$new" -eq 1 ]; then
- if [ $overwrite_conf -eq 1 ]; then
- cat <<EOF > $conf_fn
+ wconf <<EOF
; generated by vstart.sh on `date`
[$VSTART_SEC]
num mon = $CEPH_NUM_MON
run dir = $CEPH_OUT_DIR
enable experimental unrecoverable data corrupting features = *
EOF
-if [ "$lockdep" -eq 1 ] ; then
-cat <<EOF >> $conf_fn
+ if [ "$lockdep" -eq 1 ] ; then
+ wconf <<EOF
lockdep = true
EOF
-fi
-if [ "$cephx" -eq 1 ] ; then
-cat <<EOF >> $conf_fn
+ fi
+ if [ "$cephx" -eq 1 ] ; then
+ wconf <<EOF
auth supported = cephx
EOF
-else
-cat <<EOF >> $conf_fn
+ else
+ wconf <<EOF
auth cluster required = none
auth service required = none
auth client required = none
EOF
-fi
-if [ "$short" -eq 1 ]; then
- COSDSHORT=" osd max object name len = 460
+ fi
+ if [ "$short" -eq 1 ]; then
+ COSDSHORT=" osd max object name len = 460
osd max object namespace len = 64"
-fi
- cat <<EOF >> $conf_fn
-
+ fi
+ wconf <<EOF
[client]
keyring = $keyring_fn
log file = $CEPH_OUT_DIR/\$name.\$pid.log
[global]
$extra_conf
EOF
- fi
-
if [ `echo $IP | grep '^127\\.'` ]
then
echo
for f in $MONS
do
str="$str --add $f $IP:$(($CEPH_PORT+$count))"
- if [ $overwrite_conf -eq 1 ]; then
- cat <<EOF >> $conf_fn
+ wconf <<EOF
[mon.$f]
host = $HOSTNAME
mon data = $CEPH_DEV_DIR/mon.$f
mon addr = $IP:$(($CEPH_PORT+$count))
EOF
- fi
count=$(($count + 1))
done
prun "$CEPH_BIN/monmaptool" --create --clobber $str --print "$monmap_fn"
for osd in `seq 0 $((CEPH_NUM_OSD-1))`
do
if [ "$new" -eq 1 ]; then
- if [ $overwrite_conf -eq 1 ]; then
- cat <<EOF >> $conf_fn
+ wconf <<EOF
[osd.$osd]
host = $HOSTNAME
EOF
- fi
rm -rf $CEPH_DEV_DIR/osd$osd || true
for f in $CEPH_DEV_DIR/osd$osd/*; do btrfs sub delete $f &> /dev/null || true; done
# mds
if [ "$smallmds" -eq 1 ]; then
- cat <<EOF >> $conf_fn
+ wconf <<EOF
[mds]
mds log max segments = 2
mds cache size = 10000
if [ "$new" -eq 1 ]; then
prun mkdir -p "$CEPH_DEV_DIR/mds.$name"
key_fn=$CEPH_DEV_DIR/mds.$name/keyring
- if [ $overwrite_conf -eq 1 ]; then
- cat <<EOF >> $conf_fn
+ wconf <<EOF
[mds.$name]
host = $HOSTNAME
EOF
if [ "$standby" -eq 1 ]; then
mkdir -p $CEPH_DEV_DIR/mds.${name}s
- cat <<EOF >> $conf_fn
+ wconf <<EOF
mds standby for rank = $mds
[mds.${name}s]
mds standby replay = true
mds standby for name = ${name}
EOF
- fi
fi
prun $SUDO "$CEPH_BIN/ceph-authtool" --create-keyring --gen-key --name="mds.$name" "$key_fn"
ceph_adm -i "$key_fn" auth add "mds.$name" mon 'allow profile mds' osd 'allow *' mds 'allow'