extras: scripts to cleanup xattrs stored by quota.

Signed-off-by: Raghavendra G <raghavendra@gluster.com>
Signed-off-by: Vijay Bellur <vijay@gluster.com>

BUG: 2664 (Quota: recreating the volume on same bricks shows similar info as for earlier one using "list")
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2664
This commit is contained in:
Raghavendra G 2011-04-07 02:51:50 +00:00 committed by Vijay Bellur
parent 7a32aa912e
commit 476b672347
3 changed files with 49 additions and 1 deletions

View File

@ -5,5 +5,5 @@ EditorMode_DATA = glusterfs-mode.el glusterfs.vim
SUBDIRS = init.d benchmarking
EXTRA_DIST = specgen.scm MacOSX/Portfile glusterfs-mode.el glusterfs.vim migrate-unify-to-distribute.sh backend-xattr-sanitize.sh backend-cleanup.sh disk_usage_sync.sh
EXTRA_DIST = specgen.scm MacOSX/Portfile glusterfs-mode.el glusterfs.vim migrate-unify-to-distribute.sh backend-xattr-sanitize.sh backend-cleanup.sh disk_usage_sync.sh quota-remove-xattr.sh quota-metadata-cleanup.sh

View File

@ -0,0 +1,24 @@
#!/bin/bash
# This script is used to cleanup xattrs setup by quota-translator in (a)
# backend directory(ies). It takes a single or list of backend directories
# as argument(s).
usage ()
{
echo >&2 "usage: $0 <list-of-backend-directories>"
}
main ()
{
[ $# -lt 1 ] && usage
INSTALL_DIR=`dirname $0`
for i in $@; do
find $i -exec $INSTALL_DIR/quota-remove-xattr.sh '{}' \;
done
}
main $@

24
extras/quota-remove-xattr.sh Executable file
View File

@ -0,0 +1,24 @@
#!/bin/bash
# This script is used to remove xattrs set by quota translator on a path.
# It is generally invoked from quota-metadata-cleanup.sh, but can
# also be used stand-alone.
usage ()
{
echo >&2 "usage: $0 <path>"
}
main ()
{
[ $# -ne 1 ] && usage $0
XATTR_KEY_VALUE_PAIRS=`getfattr -d -m 'trusted.glusterfs.quota' $1 2>/dev/null | sed -e '/^# file/d'`
for i in $XATTR_KEY_VALUE_PAIRS; do
XATTR_KEY=`echo $i | sed -e 's/\([^=]*\).*/\1/g'`
setfattr -x $XATTR_KEY $1
done
}
main $@