3 rgw_flags
="--debug-rgw=20 --debug-ms=1"
8 [ "$@" ] ||
echo "$src: $lineno: assert failed: $@" ||
exit 1
11 assert
="eval _assert \$BASH_SOURCE \$LINENO"
13 function var_to_python_json_index
{
14 echo "['$1']" |
sed "s/\./'\]\['/g"
17 function json_extract
{
19 [ "$1" != "" ] && var
=$
(var_to_python_json_index
$1)
29 function python_array_len
{
36 function project_python_array_field
{
37 var
=$
(var_to_python_json_index
$1)
43 s += '"' + str(x$var) + '" '
56 script_dir
=`dirname $0`
57 root_path
=`(cd $script_dir/../..; pwd)`
59 mstart
=$root_path/mstart.sh
60 mstop
=$root_path/mstop.sh
62 mrgw
=$root_path/mrgw.sh
66 function start_ceph_cluster
{
67 [ $# -ne 1 ] && echo "start_ceph_cluster() needs 1 param" && exit 1
73 [ $# -lt 1 ] && echo "rgw_admin() needs 1 param" && exit 1
75 echo "$mrun $1 radosgw-admin"
79 [ $# -ne 2 ] && echo "rgw() needs 2 params" && exit 1
81 echo "$mrgw $1 $2 $rgw_flags"
84 function init_first_zone
{
85 [ $# -ne 7 ] && echo "init_first_zone() needs 7 params" && exit 1
97 x $
(rgw_admin
$cid) realm create
--rgw-realm=$realm
99 # create zonegroup, zone
100 x $
(rgw_admin
$cid) zonegroup create
--rgw-zonegroup=$zg --master --default
101 x $
(rgw_admin
$cid) zone create
--rgw-zonegroup=$zg --rgw-zone=$zone --access-key=${access_key} --secret=${secret} --endpoints=$endpoints --default
102 x $
(rgw_admin
$cid) user create
--uid=zone.user
--display-name=ZoneUser
--access-key=${access_key} --secret=${secret} --system
104 x $
(rgw_admin
$cid) period update
--commit
107 function init_zone_in_existing_zg
{
108 [ $# -ne 8 ] && echo "init_zone_in_existing_zg() needs 8 params" && exit 1
114 master_zg_zone1_port
=$5
120 x $
(rgw_admin
$cid) realm pull
--url=$url:$master_zg_zone1_port --access-key=${access_key} --secret=${secret} --default
121 x $
(rgw_admin
$cid) zonegroup default
--rgw-zonegroup=$zg
122 x $
(rgw_admin
$cid) zone create
--rgw-zonegroup=$zg --rgw-zone=$zone --access-key=${access_key} --secret=${secret} --endpoints=$endpoints
123 x $
(rgw_admin
$cid) period update
--commit
126 function init_first_zone_in_slave_zg
{
127 [ $# -ne 8 ] && echo "init_first_zone_in_slave_zg() needs 8 params" && exit 1
133 master_zg_zone1_port
=$5
139 # create zonegroup, zone
140 x $
(rgw_admin
$cid) realm pull
--url=$url:$master_zg_zone1_port --access-key=${access_key} --secret=${secret}
141 x $
(rgw_admin
$cid) realm default
--rgw-realm=$realm
142 x $
(rgw_admin
$cid) zonegroup create
--rgw-realm=$realm --rgw-zonegroup=$zg --endpoints=$endpoints --default
143 x $
(rgw_admin
$cid) zonegroup default
--rgw-zonegroup=$zg
145 x $
(rgw_admin
$cid) zone create
--rgw-zonegroup=$zg --rgw-zone=$zone --access-key=${access_key} --secret=${secret} --endpoints=$endpoints
146 x $
(rgw_admin
$cid) zone default
--rgw-zone=$zone
147 x $
(rgw_admin
$cid) zonegroup add
--rgw-zonegroup=$zg --rgw-zone=$zone
149 x $
(rgw_admin
$cid) period update
--commit
153 function call_rgw_admin
{
156 x $
(rgw_admin
$cid) "$@"