}
function rgw_admin {
- [ $# -ne 1 ] && echo "rgw_admin() needs 1 param" && exit 1
+ [ $# -lt 1 ] && echo "rgw_admin() needs 1 param" && exit 1
echo "$mrun c$1 radosgw-admin"
}
}
function init_zone_in_existing_zg {
- [ $# -ne 7 ] && echo "init_zone_in_existing_zg() needs 7 params" && exit 1
+ [ $# -ne 8 ] && echo "init_zone_in_existing_zg() needs 8 params" && exit 1
id=$1
realm=$2
zg=$3
zone=$4
- port=$5
+ zone1_port=$5
+ port=$6
- access_key=$6
- secret=$7
+ access_key=$7
+ secret=$8
- x $(rgw_admin $id) realm pull --url=http://localhost:$zone1_port --access-key=${system_access_key} --secret=${system_secret} --default
+ x $(rgw_admin $id) realm pull --url=http://localhost:$zone1_port --access-key=${access_key} --secret=${secret} --default
x $(rgw_admin $id) zonegroup default --rgw-zonegroup=$zg
- x $(rgw_admin $id) zone create --rgw-zonegroup=$zg --rgw-zone=$zone2 --access-key=${system_access_key} --secret=${system_secret} --endpoints=http://localhost:$zone2_port
+ x $(rgw_admin $id) zone create --rgw-zonegroup=$zg --rgw-zone=$zone --access-key=${access_key} --secret=${secret} --endpoints=http://localhost:$port
x $(rgw_admin $id) period update --commit
- x $(rgw $id $zone2_port) --rgw-zone=$zone2
+ x $(rgw $id $port) --rgw-zone=$zone
+}
+
+function call_rgw_admin {
+ c=$1
+ shift
+ x $(rgw_admin $c) "$@"
}
num_shards2=$(python_array_len $sync_markers)
- [ "$global_sync_status" == "sync" ] && assert $num_shards2 -eq $num_shards
+ [ "$global_sync_status" == "sync" ] && $assert $num_shards2 -eq $num_shards
sync_states=$(project_python_array_field val.state $sync_markers)
eval secondary_status=$(project_python_array_field val.marker $sync_markers)
#!/bin/bash
+[ $# -lt 1 ] && echo "usage: $0 <num-clusters>" && exit 1
+
+num_clusters=$1
+
+[ $num_clusters -lt 1 ] && echo "clusters num must be at least 1" && exit 1
+
. "`dirname $0`/test-rgw-common.sh"
. "`dirname $0`/test-rgw-meta-sync.sh"
realm_name=earth
zg=us
-zone1=${zg}-1
-zone2=${zg}-2
-zone1_port=8000
-zone2_port=8001
+i=1
+while [ $i -le $num_clusters ]; do
+ eval zone$i=${zg}-$i
+ eval zone${i}_port=$((8000+$i))
+ i=$((i+1))
+done
system_access_key="1234567890"
system_secret="pencil"
echo realm_status=$output
-# bring up second cluster
-x $(start_ceph_cluster 2) -n
-
+# bring up next clusters
-# create new zone, start rgw
-init_zone_in_existing_zg 2 $realm_name $zg $zone1 $zone1_port $system_access_key $system_secret
+i=2
+while [ $i -le $num_clusters ]; do
+ x $(start_ceph_cluster $i) -n
-wait_for_meta_sync 1 2
+ # create new zone, start rgw
+ zone_port=eval echo '$'zone${i}_port
+ init_zone_in_existing_zg $i $realm_name $zg $zone1 $zone1_port $zone_port $system_access_key $system_secret
-$(rgw_admin 1) user create --uid=user1 --display-name='user one' --secret=user1secret --access-key=USER1ACCESSKEY
-$(rgw_admin 1) user create --uid=user2 --display-name='user two' --secret=user2secret --access-key=USER2ACCESSKEY
+ i=$((i+1))
+done
-wait_for_meta_sync 1 2
+i=2
+while [ $i -le $num_clusters ]; do
+ wait_for_meta_sync 1 $i
+done