blob: 3347031cdab98933be5b929c39a8a91351b71ee8 (
plain)
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
|
#!/bin/bash
#The post-upgrade script must be executed after all the nodes in the cluster
#have upgraded to 3.5.
#Also, all the clients accessing the given volume must also be upgraded to 3.5
#before the script is run.
#Make sure glusterd and the brick processes are running on all nodes in the
#cluster post upgrade.
#Execute this script on the node where the pre-upgrade script for quota was run.
VOL=$1;
function set_limits {
local var=$(gluster volume info $1 | grep 'features.quota'| cut -d" " -f2);
if [ -z "$var" ] || [ "$var" == "off" ]; then
if [ $2 -eq '0' ]; then
echo "Volume $1 does not have quota enabled. " \
"Exiting ..."
exit 1
fi
else
gluster volume set $1 default-soft-limit 80%
if [ $? -ne '0' ]; then
echo "Post-upgrade process failed." \
"Please address the error and run " \
"post-upgrade-script.sh on volume $VOL again."
exit 1
fi
gluster volume start $1 force
sleep 3;
local path_array=( $(cat /tmp/quota-config-backup/vol_$1 | tail -n +3 | awk '{print $1}') )
local limit_array=( $(cat /tmp/quota-config-backup/vol_$1 | tail -n +3 | awk '{print $2}') )
local len=${#path_array[@]}
for ((j=0; j<$len; j++))
do
gluster volume quota $1 limit-usage ${path_array[$j]} ${limit_array[j]};
if [ $? -eq 0 ]; then
echo "Setting limit (${limit_array[j]}) on " \
"path ${path_array[$j]} has been " \
"successful"
fi
done
fi;
}
if [ -z $1 ]; then
echo "Please provide volume name or 'all'";
exit 1;
fi
if [ "$1" == "all" ]; then
for VOL in `gluster volume list`;
do
set_limits $VOL '1';
done
else
set_limits $1 '0';
fi
|