From: Jianpeng Ma Date: Fri, 23 Mar 2018 15:30:44 +0000 (+0800) Subject: vstart.sh: Avoiding ceph-conf error when create a new cluster. X-Git-Tag: v13.1.0~517^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5de320b89009188d54da1c3afb80742a283f0a71;p=ceph.git vstart.sh: Avoiding ceph-conf error when create a new cluster. This partly revert commit:f437598cfcabbd66c372bc8. Before firstly creating a ceph cluster, there is no ceph.conf. If specify a non-exist ceph.conf, ceph-conf will meet error. Signed-off-by: Jianpeng Ma --- diff --git a/src/vstart.sh b/src/vstart.sh index 1e8aea2bcd4..32e11cb2525 100755 --- a/src/vstart.sh +++ b/src/vstart.sh @@ -349,14 +349,16 @@ if [ "$overwrite_conf" -eq 0 ]; then else if [ "$new" -ne 0 ]; then # only delete if -n - asok_dir=`dirname $($CEPH_BIN/ceph-conf -c $conf_fn --show-config-value admin_socket)` - if [ $asok_dir != /var/run/ceph ]; then + if [ -e "$conf_fn" ]; then + asok_dir=`dirname $($CEPH_BIN/ceph-conf -c $conf_fn --show-config-value admin_socket)` + rm -- "$conf_fn" + if [ $asok_dir != /var/run/ceph ]; then [ -d $asok_dir ] && rm -f $asok_dir/* && rmdir $asok_dir - fi - if [ -z "$CEPH_ASOK_DIR" ]; then + fi + fi + if [ -z "$CEPH_ASOK_DIR" ]; then CEPH_ASOK_DIR=`mktemp -u -d "${TMPDIR:-/tmp}/ceph-asok.XXXXXX"` fi - [ -e "$conf_fn" ] && rm -- "$conf_fn" else CEPH_ASOK_DIR=`dirname $($CEPH_BIN/ceph-conf -c $conf_fn --show-config-value admin_socket)` # -k is implied... (doesn't make sense otherwise)