Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / src / test / rgw / test-rgw-multisite.sh
1 #!/bin/bash
2
3 [ $# -lt 1 ] && echo "usage: $0 <num-clusters>" && exit 1
4
5 num_clusters=$1
6
7 [ $num_clusters -lt 1 ] && echo "clusters num must be at least 1" && exit 1
8
9 . "`dirname $0`/test-rgw-common.sh"
10 . "`dirname $0`/test-rgw-meta-sync.sh"
11
12 set -e
13
14 realm_name=earth
15 zg=zg1
16
17 system_access_key="1234567890"
18 system_secret="pencil"
19
20 # bring up first cluster
21 x $(start_ceph_cluster c1) -n
22
23 # create realm, zonegroup, zone, start rgw
24 init_first_zone c1 $realm_name $zg ${zg}-1 8001 $system_access_key $system_secret
25 x $(rgw c1 8001)
26
27 output=`$(rgw_admin c1) realm get`
28
29 echo realm_status=$output
30
31 # bring up next clusters
32
33 i=2
34 while [ $i -le $num_clusters ]; do
35   x $(start_ceph_cluster c$i) -n
36
37   # create new zone, start rgw
38   init_zone_in_existing_zg c$i $realm_name $zg ${zg}-${i} 8001 $((8000+$i)) $zone_port $system_access_key $system_secret
39   x $(rgw c$i $((8000+$i)))
40
41   i=$((i+1))
42 done
43
44 i=2
45 while [ $i -le $num_clusters ]; do
46   wait_for_meta_sync c1 c$i $realm_name
47
48   i=$((i+1))
49 done
50