From 5de320b89009188d54da1c3afb80742a283f0a71 Mon Sep 17 00:00:00 2001 From: Jianpeng Ma Date: Fri, 23 Mar 2018 23:30:44 +0800 Subject: [PATCH] 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 --- src/vstart.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/vstart.sh b/src/vstart.sh index 1e8aea2bcd4c8..32e11cb252537 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) -- 2.39.5