From: Casey Bodley Date: Thu, 6 Apr 2017 23:05:28 +0000 (-0400) Subject: test/rgw: test_multi.py uses cluster_id for calls X-Git-Tag: v12.0.2~14^2~5 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=6be00007b8f79f1ec1a20cb4f245b7d900e70e34;p=ceph-ci.git test/rgw: test_multi.py uses cluster_id for calls this makes the underlying scripts more flexible, because they don't depend on having a cluster name in the zgX-cY format Signed-off-by: Casey Bodley --- diff --git a/src/test/rgw/test-rgw-common.sh b/src/test/rgw/test-rgw-common.sh index b92d19d2bdd..20f2e0da05c 100644 --- a/src/test/rgw/test-rgw-common.sh +++ b/src/test/rgw/test-rgw-common.sh @@ -59,101 +59,98 @@ root_path=`(cd $script_dir/../..; pwd)` mstart=$root_path/mstart.sh mstop=$root_path/mstop.sh mrun=$root_path/mrun +mrgw=$root_path/mrgw.sh function start_ceph_cluster { - [ $# -ne 2 ] && echo "start_ceph_cluster() needs 2 param" && exit 1 + [ $# -ne 1 ] && echo "start_ceph_cluster() needs 1 param" && exit 1 - echo "$mstart zg$1-c$2" + echo "$mstart $1" } function rgw_admin { - [ $# -lt 2 ] && echo "rgw_admin() needs 2 param" && exit 1 + [ $# -lt 1 ] && echo "rgw_admin() needs 1 param" && exit 1 - echo "$mrun zg$1-c$2 radosgw-admin" + echo "$mrun $1 radosgw-admin" } function rgw { - [ $# -ne 3 ] && echo "rgw() needs 3 params" && exit 1 + [ $# -ne 2 ] && echo "rgw() needs 2 params" && exit 1 - echo "$root_path/mrgw.sh zg$1-c$2 $3 $rgw_flags" + echo "$mrgw $1 $2 $rgw_flags" } function init_first_zone { - [ $# -ne 8 ] && echo "init_first_zone() needs 8 params" && exit 1 + [ $# -ne 7 ] && echo "init_first_zone() needs 7 params" && exit 1 - zgid=$1 - cid=$2 - realm=$3 - zg=$4 - zone=$5 - endpoints=$6 + cid=$1 + realm=$2 + zg=$3 + zone=$4 + endpoints=$5 - access_key=$7 - secret=$8 + access_key=$6 + secret=$7 # initialize realm - x $(rgw_admin $zgid $cid) realm create --rgw-realm=$realm + x $(rgw_admin $cid) realm create --rgw-realm=$realm # create zonegroup, zone - x $(rgw_admin $zgid $cid) zonegroup create --rgw-zonegroup=$zg --master --default - x $(rgw_admin $zgid $cid) zone create --rgw-zonegroup=$zg --rgw-zone=$zone --access-key=${access_key} --secret=${secret} --endpoints=$endpoints --default - x $(rgw_admin $zgid $cid) user create --uid=zone.user --display-name="Zone User" --access-key=${access_key} --secret=${secret} --system + x $(rgw_admin $cid) zonegroup create --rgw-zonegroup=$zg --master --default + x $(rgw_admin $cid) zone create --rgw-zonegroup=$zg --rgw-zone=$zone --access-key=${access_key} --secret=${secret} --endpoints=$endpoints --default + x $(rgw_admin $cid) user create --uid=zone.user --display-name="Zone User" --access-key=${access_key} --secret=${secret} --system - x $(rgw_admin $zgid $cid) period update --commit + x $(rgw_admin $cid) period update --commit } function init_zone_in_existing_zg { - [ $# -ne 9 ] && echo "init_zone_in_existing_zg() needs 9 params" && exit 1 - - zgid=$1 - cid=$2 - realm=$3 - zg=$4 - zone=$5 - master_zg_zone1_port=$6 - endpoints=$7 - - access_key=$8 - secret=$9 - - x $(rgw_admin $zgid $cid) realm pull --url=http://localhost:$master_zg_zone1_port --access-key=${access_key} --secret=${secret} --default - x $(rgw_admin $zgid $cid) zonegroup default --rgw-zonegroup=$zg - x $(rgw_admin $zgid $cid) zone create --rgw-zonegroup=$zg --rgw-zone=$zone --access-key=${access_key} --secret=${secret} --endpoints=$endpoints - x $(rgw_admin $zgid $cid) period update --commit --url=http://localhost:$master_zg_zone1_port --access-key=${access_key} --secret=${secret} + [ $# -ne 8 ] && echo "init_zone_in_existing_zg() needs 8 params" && exit 1 + + cid=$1 + realm=$2 + zg=$3 + zone=$4 + master_zg_zone1_port=$5 + endpoints=$6 + + access_key=$7 + secret=$8 + + x $(rgw_admin $cid) realm pull --url=http://localhost:$master_zg_zone1_port --access-key=${access_key} --secret=${secret} --default + x $(rgw_admin $cid) zonegroup default --rgw-zonegroup=$zg + x $(rgw_admin $cid) zone create --rgw-zonegroup=$zg --rgw-zone=$zone --access-key=${access_key} --secret=${secret} --endpoints=$endpoints + x $(rgw_admin $cid) period update --commit --url=http://localhost:$master_zg_zone1_port --access-key=${access_key} --secret=${secret} } function init_first_zone_in_slave_zg { - [ $# -ne 9 ] && echo "init_first_zone_in_slave_zg() needs 9 params" && exit 1 + [ $# -ne 8 ] && echo "init_first_zone_in_slave_zg() needs 8 params" && exit 1 - zgid=$1 - cid=$2 - realm=$3 - zg=$4 - zone=$5 - master_zg_zone1_port=$6 - endpoints=$7 + cid=$1 + realm=$2 + zg=$3 + zone=$4 + master_zg_zone1_port=$5 + endpoints=$6 - access_key=$8 - secret=$9 + access_key=$7 + secret=$8 # create zonegroup, zone - x $(rgw_admin $zgid $cid) realm pull --url=http://localhost:$master_zg_zone1_port --access-key=${access_key} --secret=${secret} - x $(rgw_admin $zgid $cid) realm default --rgw-realm=$realm - x $(rgw_admin $zgid $cid) zonegroup create --rgw-realm=$realm --rgw-zonegroup=$zg --endpoints=$endpoints --default - x $(rgw_admin $zgid $cid) zonegroup default --rgw-zonegroup=$zg + x $(rgw_admin $cid) realm pull --url=http://localhost:$master_zg_zone1_port --access-key=${access_key} --secret=${secret} + x $(rgw_admin $cid) realm default --rgw-realm=$realm + x $(rgw_admin $cid) zonegroup create --rgw-realm=$realm --rgw-zonegroup=$zg --endpoints=$endpoints --default + x $(rgw_admin $cid) zonegroup default --rgw-zonegroup=$zg - x $(rgw_admin $zgid $cid) zone create --rgw-zonegroup=$zg --rgw-zone=$zone --access-key=${access_key} --secret=${secret} --endpoints=$endpoints - x $(rgw_admin $zgid $cid) zone default --rgw-zone=$zone - x $(rgw_admin $zgid $cid) zonegroup add --rgw-zonegroup=$zg --rgw-zone=$zone + x $(rgw_admin $cid) zone create --rgw-zonegroup=$zg --rgw-zone=$zone --access-key=${access_key} --secret=${secret} --endpoints=$endpoints + x $(rgw_admin $cid) zone default --rgw-zone=$zone + x $(rgw_admin $cid) zonegroup add --rgw-zonegroup=$zg --rgw-zone=$zone - x $(rgw_admin $zgid $cid) user create --uid=zone.user --display-name="Zone User" --access-key=${access_key} --secret=${secret} --system - x $(rgw_admin $zgid $cid) period update --commit --url=localhost:$master_zg_zone1_port --access-key=${access_key} --secret=${secret} + x $(rgw_admin $cid) user create --uid=zone.user --display-name="Zone User" --access-key=${access_key} --secret=${secret} --system + x $(rgw_admin $cid) period update --commit --url=localhost:$master_zg_zone1_port --access-key=${access_key} --secret=${secret} } function call_rgw_admin { - zgid=$1 - cid=$2 - shift 2 - x $(rgw_admin $zgid $cid) "$@" + cid=$1 + shift 1 + x $(rgw_admin $cid) "$@" } diff --git a/src/test/rgw/test-rgw-meta-sync.sh b/src/test/rgw/test-rgw-meta-sync.sh index ec8c9e28dbb..e510c6285b5 100755 --- a/src/test/rgw/test-rgw-meta-sync.sh +++ b/src/test/rgw/test-rgw-meta-sync.sh @@ -5,10 +5,10 @@ set -e function get_metadata_sync_status { - id=$1 + cid=$1 realm=$2 - meta_sync_status_json=`$(rgw_admin $zgid $cid) --rgw-realm=$realm metadata sync status` + meta_sync_status_json=`$(rgw_admin $cid) --rgw-realm=$realm metadata sync status` global_sync_status=$(json_extract sync_status.info.status $meta_sync_status_json) num_shards=$(json_extract sync_status.info.num_shards $meta_sync_status_json) @@ -26,27 +26,25 @@ function get_metadata_sync_status { } function get_metadata_log_status { - zgid=$1 - master_id=$1 + cid=$1 realm=$2 - master_mdlog_status_json=`$(rgw_admin $zgid $master_id) --rgw_realm=$realm mdlog status` + master_mdlog_status_json=`$(rgw_admin $cid) --rgw-realm=$realm mdlog status` master_meta_status=$(json_extract "" $master_mdlog_status_json) eval master_status=$(project_python_array_field marker $master_meta_status) } function wait_for_meta_sync { - zgid=$1 - master_id=$2 - cid=$3 - realm=$4 + master_id=$1 + cid=$2 + realm=$3 - get_metadata_log_status $zgid $master_id $realm + get_metadata_log_status $master_id $realm echo "master_status=${master_status[*]}" while true; do - get_metadata_sync_status $zgid $cid $realm + get_metadata_sync_status $cid $realm echo "secondary_status=${secondary_status[*]}" diff --git a/src/test/rgw/test_multi.py b/src/test/rgw/test_multi.py index 5baa9119438..18a44a07aa5 100644 --- a/src/test/rgw/test_multi.py +++ b/src/test/rgw/test_multi.py @@ -137,11 +137,11 @@ class RGWCluster: mstop(self.cluster_id, 'radosgw') def rgw_admin(self, cmd, check_retcode = True): - (s, retcode) = bash(tpath('test-rgw-call.sh', 'call_rgw_admin', self.zg_num, self.cluster_num, cmd), check_retcode) + (s, retcode) = bash(tpath('test-rgw-call.sh', 'call_rgw_admin', self.cluster_id, cmd), check_retcode) return (s, retcode) def rgw_admin_ro(self, cmd, check_retcode = True): - (s, retcode) = bash(tpath('test-rgw-call.sh', 'call_rgw_admin', self.zg_num, self.cluster_num, '--rgw-cache-enabled=false ' + cmd), check_retcode) + (s, retcode) = bash(tpath('test-rgw-call.sh', 'call_rgw_admin', self.cluster_id, '--rgw-cache-enabled=false ' + cmd), check_retcode) return (s, retcode) class RGWZone: @@ -175,15 +175,15 @@ class RGWZonegroup: endpoints = ",".join(map(lambda x: "http://localhost:" + str(cluster.port + x), range(cluster.num_gateways))) if is_master: if self.is_master_zg: - bash(tpath('test-rgw-call.sh', 'init_first_zone', cluster.zg_num, cluster.cluster_num, + bash(tpath('test-rgw-call.sh', 'init_first_zone', cluster.cluster_id, self.realm_name, zg_name, zone_name, endpoints, self.credentials.access_key, self.credentials.secret)) else: - bash(tpath('test-rgw-call.sh', 'init_first_zone_in_slave_zg', cluster.zg_num, cluster.cluster_num, + bash(tpath('test-rgw-call.sh', 'init_first_zone_in_slave_zg', cluster.cluster_id, self.realm_name, zg_name, zone_name, master_zg_first_zone_port, endpoints, self.credentials.access_key, self.credentials.secret)) else: - bash(tpath('test-rgw-call.sh', 'init_zone_in_existing_zg', cluster.zg_num, cluster.cluster_num, + bash(tpath('test-rgw-call.sh', 'init_zone_in_existing_zg', cluster.cluster_id, self.realm_name, zg_name, zone_name, master_zg_first_zone_port, endpoints, self.credentials.access_key, self.credentials.secret))