1
|
#!/bin/bash
|
2
|
|
3
|
# cluster 1
|
4
|
MON=1 OSD=1 RGW=1 MGR=0 MDS=0 ../src/mstart.sh c1 -n -d
|
5
|
./bin/radosgw-admin -c ./run/c1/ceph.conf realm create --rgw-realm=realm1
|
6
|
./bin/radosgw-admin -c ./run/c1/ceph.conf zonegroup create --rgw-realm=realm1 --rgw-zonegroup=zg1 --master --endpoints=http://127.0.0.1:8001
|
7
|
./bin/radosgw-admin -c ./run/c1/ceph.conf zone create --rgw-realm=realm1 --rgw-zonegroup=zg1 --rgw-zone=zone1 --endpoints=http://127.0.0.1:8001 --master
|
8
|
./bin/radosgw-admin -c ./run/c1/ceph.conf period update --commit --rgw-realm=realm1 --rgw-zonegroup=zg1 --rgw-zone=zone1
|
9
|
./bin/radosgw-admin -c ./run/c1/ceph.conf user create --rgw-realm=realm1 --rgw-zonegroup=zg1 --rgw-zone=zone1 --uid=test4 --display-name=test4 --access-key=test4 --secret=test4 --system
|
10
|
./bin/radosgw-admin -c ./run/c1/ceph.conf user create --rgw-realm=realm1 --rgw-zonegroup=zg1 --rgw-zone=zone1 --uid=test3 --display-name=test3 --access-key=test3 --secret=test3
|
11
|
./bin/radosgw-admin -c ./run/c1/ceph.conf caps add --uid=test3 --caps="users=*buckets=*;"
|
12
|
./bin/radosgw-admin -c ./run/c1/ceph.conf zone modify --rgw-realm=realm1 --rgw-zonegroup=zg1 --rgw-zone=zone1 --access-key=test4 --secret-key=test4
|
13
|
./bin/radosgw-admin -c ./run/c1/ceph.conf period update --commit --rgw-realm=realm1 --rgw-zonegroup=zg1 --rgw-zone=zone1
|
14
|
kill $(cat run/c1/out/radosgw.8001.pid)
|
15
|
sleep 3
|
16
|
./bin/radosgw -c ./run/c1/ceph.conf --log-file=./run/c1/out/radosgw.8001.log --admin-socket=./run/c1/out/radosgw.8001.asok --pid-file=./run/c1/out/radosgw.8001.pid --rgw_luarocks_location=./run/c1/out/luarocks --debug-rgw=20 --debug-ms=1 -n client.rgw.8001 --rgw_frontends='beast port=8001' --rgw_realm=realm1 --rgw_zonegroup=zg1 --rgw_zone=zone1
|
17
|
sleep 3
|
18
|
curl -L http://localhost:8001
|
19
|
|
20
|
# cluster 2
|
21
|
MON=1 OSD=1 RGW=1 MGR=0 MDS=0 ../src/mstart.sh c2 -n -d
|
22
|
./bin/radosgw-admin -c ./run/c2/ceph.conf realm pull --url=http://localhost:8001 --access-key=test4 --secret=test4
|
23
|
./bin/radosgw-admin -c ./run/c2/ceph.conf zone create --rgw-realm=realm1 --rgw-zonegroup=zg1 --rgw-zone=zone2 --endpoints=http://127.0.0.1:8002 --access-key=test4 --secret-key=test4
|
24
|
./bin/radosgw-admin -c ./run/c2/ceph.conf period update --commit --rgw-realm=realm1 --rgw-zonegroup=zg1 --rgw-zone=zone2
|
25
|
kill $(cat run/c2/out/radosgw.8002.pid)
|
26
|
sleep 3
|
27
|
./bin/radosgw -c ./run/c2/ceph.conf --log-file=./run/c2/out/radosgw.8002.log --admin-socket=./run/c2/out/radosgw.8002.asok --pid-file=./run/c2/out/radosgw.8002.pid --rgw_luarocks_location=./run/c2/out/luarocks --debug-rgw=20 --debug-ms=1 -n client.rgw.8002 --rgw_frontends='beast port=8002' --rgw_realm=realm1 --rgw_zonegroup=zg1 --rgw_zone=zone2
|
28
|
#./bin/radosgw-admin -c ./run/c2/ceph.conf period update --commit --rgw-realm=realm1 --rgw-zonegroup=zg1 --rgw-zone=zone2
|
29
|
sleep 5
|
30
|
curl -L http://localhost:8002
|
31
|
|
32
|
### ADMIN API USER CREATION REQUESTS ON PRIMARY CLUSTER
|
33
|
# NO KEYS: SUCEEDS EXPECTED BEHAVIOR
|
34
|
#sh ../examples/rgw_admin_curl.sh -a test3 -s test3 -e localhost:8001 -r PUT -p user -q "uid=foouser&display-name=foo"
|
35
|
# PROVIDE KEYS: SUCEEDS EXPECTED BEHAVIOR
|
36
|
#sh ../examples/rgw_admin_curl.sh -a test3 -s test3 -e localhost:8001 -r PUT -p user -q "uid=foouser&display-name=foo&access-key=akey&secret-key=skey"
|
37
|
# GENERATE-KEYS: SUCEEDS EXPECTED BEHAVIOR
|
38
|
#sh ../examples/rgw_admin_curl.sh -a test3 -s test3 -e localhost:8001 -r PUT -p user -q "uid=foouser&display-name=foo&generate-key=True"
|
39
|
|
40
|
|
41
|
### ADMIN API USER CREATION REQUESTS ON SECONDARY CLUSTER
|
42
|
# NO KEYS: returns keys that do not look the same as what's in radosgw-admin user info
|
43
|
sh ../examples/rgw_admin_curl.sh -a test3 -s test3 -e localhost:8002 -r PUT -p user -q "uid=foouser&display-name=foo"
|
44
|
# PROVIDE KEYS: returns keys that do look the same as what's in radosgw-admin user info but are NOT what the user had input
|
45
|
#sh ../examples/rgw_admin_curl.sh -a test3 -s test3 -e localhost:8002 -r PUT -p user -q "uid=foouser&display-name=foo&access-key=akey&secret-key=skey"
|
46
|
# GENERATE-KEYS: returns keys that do not look the same as what's in radosgw-admin user info
|
47
|
#sh ../examples/rgw_admin_curl.sh -a test3 -s test3 -e localhost:8002 -r PUT -p user -q "uid=foouser&display-name=foo&generate-key=True"
|
48
|
|
49
|
|
50
|
# In all tests there is no difference between keys see on radosgw-admin user info run on primary cluster vs secondary
|
51
|
#./bin/radosgw-admin -c ./run/c1/ceph.conf user info --uid=foouser
|
52
|
./bin/radosgw-admin -c ./run/c2/ceph.conf user info --uid=foouser
|
53
|
|
54
|
../src/mstop.sh c1
|
55
|
../src/mstop.sh c2
|