Skip to content

Commit

Permalink
vstart.sh: drop .ceph_port and use randomly selected available port
Browse files Browse the repository at this point in the history
vstart.sh becomes independent of do_cmake.sh

Signed-off-by: Shinobu Kinjo <shinobu@redhat.com>
  • Loading branch information
shinobu-x committed Dec 1, 2017
1 parent 1e83b5e commit 5a3eed7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
3 changes: 0 additions & 3 deletions do_cmake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.
10 changes: 7 additions & 3 deletions src/vstart.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5a3eed7

Please sign in to comment.