From 9f2c7418f546d616ac8c6412add8b56847cac506 Mon Sep 17 00:00:00 2001 From: Patrick Donnelly Date: Fri, 8 Jul 2016 19:00:12 -0400 Subject: [PATCH] vstart: refactor and fix forced config changes Despite using the -k option, vstart would sometimes (e.g. --smallmds) append changes to the config file. This commit runs all config changes through a function which checks if the config file should be overwritten. Signed-off-by: Patrick Donnelly --- src/vstart.sh | 55 ++++++++++++++++++++++++--------------------------- 1 file changed, 26 insertions(+), 29 deletions(-) diff --git a/src/vstart.sh b/src/vstart.sh index 4d53bef41ca..c5fc5c707d6 100755 --- a/src/vstart.sh +++ b/src/vstart.sh @@ -289,6 +289,8 @@ if [ "$overwrite_conf" -eq 0 ]; then 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 @@ -327,6 +329,12 @@ run() { fi } +wconf() { + if [ "$overwrite_conf" -eq 1 ]; then + cat >> "$conf_fn" + fi +} + if [ "$debug" -eq 0 ]; then CMONDEBUG=' debug mon = 10 @@ -457,10 +465,8 @@ DAEMONOPTS=" if [ "$start_mon" -eq 1 ]; then - if [ "$new" -eq 1 ]; then - if [ $overwrite_conf -eq 1 ]; then - cat < $conf_fn + wconf <> $conf_fn + if [ "$lockdep" -eq 1 ] ; then + wconf <> $conf_fn + fi + if [ "$cephx" -eq 1 ] ; then + wconf <> $conf_fn + else + wconf <> $conf_fn - + fi + wconf <> $conf_fn + wconf <> $conf_fn + wconf < /dev/null || true; done @@ -654,7 +653,7 @@ fi # mds if [ "$smallmds" -eq 1 ]; then - cat <> $conf_fn + wconf <> $conf_fn + wconf <> $conf_fn + wconf <