forked from racpatel/DFGRGWtest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathresetRGW.sh
117 lines (96 loc) · 3.61 KB
/
resetRGW.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#!/bin/bash
# RESETRGW.sh
myPath="${BASH_SOURCE%/*}"
if [[ ! -d "$myPath" ]]; then
myPath="$PWD"
fi
# Variables
source "$myPath/vars.shinc"
#------------------------
# BEGIN FUNCTIONS
function delete_pools {
for pl in ${pool_list[@]}; do
if [ $pl != "rbd" ]; then
$execMON ceph osd pool delete $pl $pl --yes-i-really-really-mean-it
fi
done
sleep 5
$execMON ceph osd crush rule rm default.rgw.buckets.data
}
function create_pools {
if [ "$1" == "rep" ]; then
cmdtail="replicated"
elif [ "$1" == "ec" ]; then
cmdtail="erasure myprofile"
$execMON ceph osd erasure-code-profile rm myprofile
$execMON ceph osd erasure-code-profile set myprofile k=$k m=$m
$execMON ceph osd crush rule create-erasure default.rgw.buckets.data myprofile
else
echo "unknown value for REPLICATION in create_pools"; exit
fi
for pl in ${pool_list[@]}; do
if [ $pl == "default.rgw.buckets.data" ]; then
$execMON ceph osd pool create $pl $pg_data $cmdtail
if [ "$1" == "rep" ]; then
$execMON ceph osd pool set $pl size "${numREPLICAS}"
fi
elif [ $pl == "default.rgw.buckets.index" ]; then
$execMON ceph osd pool create $pl $pg_index replicated
$execMON ceph osd pool set $pl size "${numREPLICAS}"
else
$execMON ceph osd pool create $pl $pg replicated
$execMON ceph osd pool set $pl size "${numREPLICAS}"
fi
done
# enable RGW on the pools for RHCS 3.x builds
if echo $CEPH_VERSION | grep -q "10.2." ; then
echo "Skip pool enable for 2.5 versions"
else
for pool in $(rados lspools); do
$execMON ceph osd pool application enable $pool rgw
done
fi
}
# END FUNCTIONS
#------------------------
echo "$PROGNAME: Running with these values:"
echo "RGWhostname=$RGWhostname r=$REPLICATION k=$k m=$m pgdata=$pg_data pgindex=$pg_index \
pg=$pg f=$fast_read"
echo "runmode=$runmode"
if [ $runmode == "containerized" ]; then
nt_start=$(ssh $RGWhostname 'bash -s' < Utils/thr_time.sh)
echo -e $nt_start
fi
echo "Stopping RGWs, and echoing status"
ansible -m shell -a 'systemctl stop ceph-radosgw.target' rgws
sleep 5
ansible -o -m shell -a 'systemctl status ceph-radosgw.target |grep Act' rgws
# ensure that pool deletion is enabled
$execMON ceph tell mon.\* injectargs '--mon-allow-pool-delete=true'
sleep 2
echo "Removing existing/old pools"
delete_pools
echo "Creating new pools"
create_pools $REPLICATION
# echo "sleeping for $longPAUSE seconds..."; sleep "${longPAUSE}"
echo "sleeping for 30 seconds..."; sleep 30
echo "Starting RGWs, and echoing status"
ansible -m shell -a 'systemctl start ceph-radosgw.target' rgws
sleep 5
ansible -o -m shell -a 'systemctl status ceph-radosgw.target |grep Act' rgws
echo "Creating User - which generates a new Password"
$execRGW 'radosgw-admin user create --uid=johndoe --display-name="John Doe" [email protected]' &&
$execRGW 'radosgw-admin subuser create --uid=johndoe --subuser=johndoe:swift --access=full'
# Edit the Password into the XML workload files
echo "inserting new password into XML files $FILLxml, $AGExml, $UPGRADExml, $MEASURExml"
key=$($execRGW 'radosgw-admin user info --uid=johndoe | grep secret_key' | tail -1 | awk '{print $2}' | sed 's/"//g')
sed -i "s/password=.*;/password=$key;/g" ${FILLxml}
sed -i "s/password=.*;/password=$key;/g" ${AGExml}
sed -i "s/password=.*;/password=$key;/g" ${MEASURExml}
sed -i "s/password=.*;/password=$key;/g" ${UPGRADExml}
if [ $runmode == "containerized" ]; then
nt_end=$(ssh $RGWhostname 'bash -s' < Utils/thr_time.sh)
echo -e $nt_end
fi
echo "$PROGNAME: Done"
# DONE