@@ -11,14 +11,21 @@ show_help() {
1111 echo " -u, --use-cached-image Uses the existing podman image in local. Only use this if there is such an image present."
1212 echo " -dir, --ceph-dir Use this to provide the local ceph directory. eg. --ceph-dir=/path/to/ceph"
1313 echo " -e, --expanded-cluster To add all the hosts and deploy OSDs on top of it."
14+ echo " -c, --clusters Number of clusters to be created. Default is 1."
15+ echo " -n, --nodes Number of nodes to be created per cluster. Default is 3."
1416 echo " -h, --help Display this help message."
1517 echo " "
1618 echo " Example:"
1719 echo " ./quick-bootstrap.sh --use-cached-image"
1820}
1921
22+ GREEN=' \033[0;32m'
23+ RESET=' \033[0m'
24+
2025use_cached_image=false
2126extra_args=" -P quick_install=True"
27+ CLUSTERS=1
28+ NODES=3
2229
2330for arg in " $@ " ; do
2431 case " $arg " in
@@ -31,6 +38,12 @@ for arg in "$@"; do
3138 -e|--expanded-cluster)
3239 extra_args+=" -P expanded_cluster=True"
3340 ;;
41+ -n=* |--nodes=* )
42+ NODES=" ${arg#* =} "
43+ ;;
44+ -c=* |--clusters=* )
45+ CLUSTERS=" ${arg#* =} "
46+ ;;
3447 -h|--help)
3548 show_help
3649 exit 0
@@ -44,8 +57,8 @@ for arg in "$@"; do
4457done
4558
4659image_name=$( echo " $CEPHADM_IMAGE " )
47- ceph_cluster_yml= ' ceph_cluster.yml '
48- node_count= $( awk ' /nodes:/ {print $2} ' " ${ceph_cluster_yml} " )
60+
61+ extra_args+= " -P nodes= ${NODES} "
4962
5063if [[ ${use_cached_image} == false ]]; then
5164 printf " Pulling the image: %s\n" " $image_name "
@@ -57,30 +70,44 @@ rm -f ceph_image.tar
5770printf " Saving the image: %s\n" " $image_name "
5871podman save -o ceph_image.tar quay.ceph.io/ceph-ci/ceph:main
5972
60- printf " Creating the plan\n"
61- kcli create plan -f ceph_cluster.yml ${extra_args} ceph
73+ NODE_IP_OFFSET=100
74+ PREFIX=" ceph"
75+ for cluster in $( seq 1 $CLUSTERS ) ; do
76+ if [[ $cluster -gt 1 ]]; then
77+ PREFIX=" ceph${cluster} "
78+ fi
79+ printf " \nCreating cluster: %s\n" " ${PREFIX} "
80+ kcli create plan -f ceph_cluster.yml ${extra_args} -P node_ip_offset=${NODE_IP_OFFSET} \
81+ -P prefix=${PREFIX} ${PREFIX}
82+ NODE_IP_OFFSET=$(( NODE_IP_OFFSET + 10 ))
83+ done
6284
6385attempt=0
6486
6587MAX_ATTEMPTS=10
6688SLEEP_INTERVAL=5
6789
68- printf " Waiting for the host to be reachable\n"
69- while [[ ${attempt} -lt ${MAX_ATTEMPTS} ]]; do
70- if ssh -o StrictHostKeyChecking=no -o BatchMode=yes -o ConnectTimeout=10
[email protected] exit ; then 71- break
72- else
73- echo " Waiting for ssh connection to be available..., attempt: ${attempt} "
74- (( attempt++ ))
75- sleep ${SLEEP_INTERVAL}
76- fi
90+ NODE_IP_OFFSET=100
91+ PREFIX=" ceph"
92+ for cluster in $( seq 1 $CLUSTERS ) ; do
93+ if [[ $cluster -gt 1 ]]; then
94+ PREFIX=" ceph${cluster} "
95+ fi
96+ printf " \nWaiting for the host to be reachable on cluster ${PREFIX} ...\n"
97+
98+ while [[ ${attempt} -lt ${MAX_ATTEMPTS} ]]; do
99+ if ssh -o StrictHostKeyChecking=no -o BatchMode=yes -o ConnectTimeout=10
[email protected] .
" ${NODE_IP_OFFSET} " exit ; then 100+ printf " \n${GREEN} Host is reachable on cluster %s\n${RESET} " " ${PREFIX} "
101+ break
102+ else
103+ echo " Waiting for ssh connection to be available..., attempt: ${attempt} "
104+ (( attempt++ ))
105+ sleep ${SLEEP_INTERVAL}
106+ fi
107+ done
108+
109+ NODE_IP_OFFSET=$(( NODE_IP_OFFSET + 10 ))
77110done
78111
79- printf " Copying the image to the hosts\n"
80-
81- for node in $( seq 0 $(( node_count - 1 )) ) ; do
82- scp -o StrictHostKeyChecking=no ceph_image.tar
[email protected] " ${node} " :/root/
83- done
84-
85- rm -f ceph_image.tar
112+ printf " \nOpening logs for first cluster"
86113kcli ssh -u root -- ceph-node-00 ' journalctl -n all -ft cloud-init'
0 commit comments