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 --- doc/upgrade/quota-upgrade-steps.md | 6 +++--- extras/Makefile.am | 2 ++ extras/post-upgrade-script-for-quota.sh | 6 ++++-- extras/pre-upgrade-script-for-quota.sh | 7 +++++-- glusterfs.spec.in | 3 ++- 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/doc/upgrade/quota-upgrade-steps.md b/doc/upgrade/quota-upgrade-steps.md index 334f0f415d9..de512873716 100644 --- a/doc/upgrade/quota-upgrade-steps.md +++ b/doc/upgrade/quota-upgrade-steps.md @@ -10,7 +10,7 @@ Pre-Upgrade Script: ###What it does: -The pre-upgrade script (pre-upgrade-script-for-quota.sh) iterates over the list of volumes that have quota enabled and captures the configured quota limits for each such volume in a file under /tmp/quota-config-backup/vol_<VOLNAME> by executing 'quota list' command on each one of them. +The pre-upgrade script (pre-upgrade-script-for-quota.sh) iterates over the list of volumes that have quota enabled and captures the configured quota limits for each such volume in a file under /var/tmp/glusterfs/quota-config-backup/vol_<VOLNAME> by executing 'quota list' command on each one of them. ###Pre-requisites for running Pre-Upgrade Script: @@ -39,7 +39,7 @@ Because the cluster must be operating at op-version 3 for quota to work in 3.5, Once this is done, these volumes are started forcefully using `volume start force` to launch the Quota Daemon on all the nodes. -Thereafter, for each of these volumes, the paths and the limits configured on them are retrieved from the backed up file /tmp/quota-config-backup/vol_<VOLNAME> and limits are set on them via the `quota limit-usage` interface. +Thereafter, for each of these volumes, the paths and the limits configured on them are retrieved from the backed up file /var/tmp/glusterfs/quota-config-backup/vol_<VOLNAME> and limits are set on them via the `quota limit-usage` interface. ####Note: In the new version of quota, the command `quota limit-usage` will fail if the directory on which quota limit is to be set for a given volume does not exist. Therefore, it is advised that you create these directories first before running post-upgrade-script-for-quota.sh if you want limits to be set on these directories. @@ -76,4 +76,4 @@ In the second case, the post-upgrade script picks on its own, the volumes on whi ####Note: 1. In the second case, post-upgrade-script-for-quota.sh exits prematurely upon failure to ugprade any given volume. In that case, you may run post-upgrade-script-for-quota.sh individually (using the volume name as command line argument) on this volume and also on all volumes appearing after this volume in the output of `gluster volume list`, that have quota enabled. -2. The backed up files under /tmp/quota-config-backup/ are retained after the post-upgrade procedure for reference. +2. The backed up files under /var/tmp/glusterfs/quota-config-backup/ are retained after the post-upgrade procedure for reference. 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 diff --git a/glusterfs.spec.in b/glusterfs.spec.in index 9798ab2ba17..65e39b677e6 100644 --- a/glusterfs.spec.in +++ b/glusterfs.spec.in @@ -707,7 +707,8 @@ rm -rf %{buildroot} %exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/encryption/rot-13* %exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/mac-compat* %exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/testing/performance/symlink-cache* - +%{_datadir}/glusterfs/scripts/post-upgrade-script-for-quota.sh +%{_datadir}/glusterfs/scripts/pre-upgrade-script-for-quota.sh %post libs /sbin/ldconfig -- cgit