From d4cc7595b5e21a92386e41f7ad7570ad9a728bd4 Mon Sep 17 00:00:00 2001 From: Krutika Dhananjay Date: Fri, 4 Apr 2014 17:00:09 +0530 Subject: rpms: Add quota upgrade scripts to rpms Also replace /tmp/quota-config-backup with /var/tmp/glusterfs/quota-config-backup in doc and upgrade scripts. Change-Id: I289662300d32f75e2fc6e789037c3224054a38a5 BUG: 969461 Signed-off-by: Krutika Dhananjay Reviewed-on: http://review.gluster.org/7401 Reviewed-by: Humble Devassy Chirammal Tested-by: Gluster Build System Reviewed-by: Niels de Vos Reviewed-by: Vijay Bellur --- extras/Makefile.am | 2 ++ extras/post-upgrade-script-for-quota.sh | 6 ++++-- extras/pre-upgrade-script-for-quota.sh | 7 +++++-- 3 files changed, 11 insertions(+), 4 deletions(-) (limited to 'extras') diff --git a/extras/Makefile.am b/extras/Makefile.am index 3d780a0058f..c2c1c419769 100644 --- a/extras/Makefile.am +++ b/extras/Makefile.am @@ -9,6 +9,8 @@ conf_DATA = glusterfs-logrotate gluster-rsyslog-7.2.conf gluster-rsyslog-5.8.con voldir = $(sysconfdir)/glusterfs vol_DATA = glusterd.vol +scriptsdir = $(datadir)/glusterfs/scripts +scripts_DATA = post-upgrade-script-for-quota.sh pre-upgrade-script-for-quota.sh EXTRA_DIST = specgen.scm MacOSX/Portfile glusterfs-mode.el glusterfs.vim \ migrate-unify-to-distribute.sh backend-xattr-sanitize.sh \ diff --git a/extras/post-upgrade-script-for-quota.sh b/extras/post-upgrade-script-for-quota.sh index 3347031cdab..13b65e8870e 100755 --- a/extras/post-upgrade-script-for-quota.sh +++ b/extras/post-upgrade-script-for-quota.sh @@ -10,6 +10,8 @@ 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); @@ -31,8 +33,8 @@ function set_limits { 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 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++)) diff --git a/extras/pre-upgrade-script-for-quota.sh b/extras/pre-upgrade-script-for-quota.sh index 522e41206d0..ddb4f7fa450 100755 --- a/extras/pre-upgrade-script-for-quota.sh +++ b/extras/pre-upgrade-script-for-quota.sh @@ -5,12 +5,15 @@ #This script must be run prior to upgrading the cluster to 3.5, that too on #only one of the nodes in the cluster. -mkdir -p /tmp/quota-config-backup +BACKUP_DIR=/var/tmp/glusterfs/quota-config-backup + +mkdir -p $BACKUP_DIR + for i in `gluster volume list`; do var=$(gluster volume info $i | grep 'features.quota'| cut -d" " -f2); if [ -z "$var" ] || [ "$var" == "off" ]; then continue else - gluster volume quota $i list > /tmp/quota-config-backup/vol_$i; + gluster volume quota $i list > $BACKUP_DIR/vol_$i; fi; done -- cgit