glusterfs/extras/post-upgrade-script-for-quota.sh
Emmanuel Dreyfus 618d465295 NetBSD build fixes
- Shell scripts: == is specific to bash and ksh. Use = instead.
- Shell scripts: use sh instead of bash if bash functionnality is not used
- Shell scripts: ${var/search/replace} is specific to bash
- sed: The -i option is specific to GNU sed.
- Makefiles: $< outside of generic rules only work in GNU make.
- xdrproc_t() is not universally defined as variadic. Do not specify third
  argument if it is not used
- NetBSD FUSE specific: only include <perfuse.h> in FUSE client code,
  it harms in other locations
- configure: Search for gettext() in libintl as NetBSD stores it there
- Like MacOS X, NetBSD has unmount(2) and not umount(2) (un vs u)

Some other build issues previously included in this change were
removed:
- __THROW macro, addressed in http://review.gluster.com/#/c/7757/
- getmntent() compat shared with MacOS X, in http://review.gluster.com/#/c/7722/

This patchset adds warning fixes for mount_glusterfs

BUG: 764655
Change-Id: I2f1faf8ff96362d3e2baf237b943df619011f1f4
Signed-off-by: Emmanuel Dreyfus <manu@netbsd.org>
Reviewed-on: http://review.gluster.org/7783
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Harshavardhana <harsha@harshavardhana.net>
2014-05-17 11:53:34 -07:00

66 lines
2.2 KiB
Bash
Executable File

#!/bin/bash
#The post-upgrade script must be executed after all the nodes in the cluster
#have upgraded.
#Also, all the clients accessing the given volume must also be upgraded
#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;
BACKUP_DIR=/var/tmp/glusterfs/quota-config-backup
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 $BACKUP_DIR/vol_$1 | tail -n +3 | awk '{print $1}') )
local limit_array=( $(cat $BACKUP_DIR/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