From 5ddfd572b31cddbe548459b5ed24e9f0a5239e08 Mon Sep 17 00:00:00 2001 From: xie xingguo Date: Wed, 8 May 2019 16:54:50 +0800 Subject: [PATCH] vstart: add --inc-osd option I am currently developing some scale-up[down] related feature. It would be nice if I can simply develop and test it on the vcluster at the early stage. Signed-off-by: xie xingguo --- src/vstart.sh | 43 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 4 deletions(-) diff --git a/src/vstart.sh b/src/vstart.sh index 40267bd6853..08d5d9ee9b5 100755 --- a/src/vstart.sh +++ b/src/vstart.sh @@ -164,6 +164,7 @@ conf_fn="$CEPH_CONF_PATH/ceph.conf" keyring_fn="$CEPH_CONF_PATH/keyring" osdmap_fn="/tmp/ceph_osdmap.$$" monmap_fn="/tmp/ceph_monmap.$$" +inc_osd_num=0 msgr="21" @@ -207,6 +208,7 @@ usage=$usage"\t--msgr21: use msgr2 and msgr1\n" usage=$usage"\t--crimson: use crimson-osd instead of ceph-osd\n" usage=$usage"\t--osd-args: specify any extra osd specific options\n" usage=$usage"\t--bluestore-devs: comma-separated list of blockdevs to use for bluestore\n" +usage=$usage"\t--inc-osd: append some more osds into existing vcluster\n" usage_exit() { printf "$usage" @@ -235,6 +237,16 @@ case $1 in --new | -n ) new=1 ;; + --inc-osd ) + new=0 + kill_all=0 + inc_osd_num=$2 + if [ "$inc_osd_num" == "" ]; then + inc_osd_num=1 + else + shift + fi + ;; --not-new | -N ) new=0 ;; @@ -798,9 +810,18 @@ EOF } start_osd() { - for osd in `seq 0 $(($CEPH_NUM_OSD-1))` + if [ $inc_osd_num -gt 0 ]; then + old_maxosd=$($CEPH_BIN/ceph osd getmaxosd | sed -e 's/max_osd = //' -e 's/ in epoch.*//') + start=$old_maxosd + end=$(($start-1+$inc_osd_num)) + overwrite_conf=1 # fake wconf + else + start=0 + end=$(($CEPH_NUM_OSD-1)) + fi + for osd in `seq $start $end` do - if [ "$new" -eq 1 ]; then + if [ "$new" -eq 1 -o $inc_osd_num -gt 0 ]; then wconf <