From: Shinobu Kinjo Date: Fri, 1 Dec 2017 02:05:57 +0000 (+0900) Subject: vstart.sh: drop .ceph_port and use randomly selected available port X-Git-Tag: v13.0.2~696^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5a3eed74d859ae9cc084c7343f01da95840dbe55;p=ceph.git vstart.sh: drop .ceph_port and use randomly selected available port vstart.sh becomes independent of do_cmake.sh Signed-off-by: Shinobu Kinjo --- diff --git a/do_cmake.sh b/do_cmake.sh index b8e092d1332c..084194c4b842 100755 --- a/do_cmake.sh +++ b/do_cmake.sh @@ -22,7 +22,4 @@ plugin dir = lib erasure code dir = lib EOF -# give vstart a (hopefully) unique mon port to start with -echo $(( RANDOM % 1000 + 40000 )) > .ceph_port - echo done. diff --git a/src/vstart.sh b/src/vstart.sh index 55b10e918951..0ceef3eda22b 100755 --- a/src/vstart.sh +++ b/src/vstart.sh @@ -805,9 +805,13 @@ if [ -n "$MON_ADDR" ]; then CMDS_ARGS=" -m "$MON_ADDR fi -if [ -z "$CEPH_PORT" ]; then - CEPH_PORT=6789 - [ -e ".ceph_port" ] && CEPH_PORT=`cat .ceph_port` +if [ -z "$CEPH_PORT" ] +then + while [ true ] + do + CEPH_PORT="$(echo $(( RANDOM % 1000 + 40000 )))" + ss -a -n | egrep ":${CEPH_PORT} .+LISTEN" 1>/dev/null 2>&1 || break + done fi [ -z "$INIT_CEPH" ] && INIT_CEPH=$CEPH_BIN/init-ceph