diff options
| author | vmallika <vmallika@redhat.com> | 2016-02-10 16:27:05 +0530 | 
|---|---|---|
| committer | Atin Mukherjee <amukherj@redhat.com> | 2016-03-03 22:15:37 -0800 | 
| commit | 1da6a7525eb83f429c6f6ef2bba58c0adf3f64aa (patch) | |
| tree | 01ee13f68c307c85d29d84c4620a2a366ad2d513 /extras/hook-scripts | |
| parent | 81fae33cb7ce70f885ce52fa0cc71b3435333a53 (diff) | |
quota: heal object-limit on a root dir of a newly added brick
This is a backport of http://review.gluster.org/13422
When a new brick is added, xattr trusted.glusterfs.quota.limit-objects
is not healed on a root directory.
This patch will fix the problem
> Change-Id: I776609ebf4d7822c541b6262e63d465ea3a86db4
> BUG: 1306220
> Signed-off-by: vmallika <vmallika@redhat.com>
> Reviewed-on: http://review.gluster.org/13422
> Smoke: Gluster Build System <jenkins@build.gluster.com>
> CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
> Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Change-Id: I47412b4da35c0f5d28106020daf32212d267cb9e
BUG: 1312954
Signed-off-by: vmallika <vmallika@redhat.com>
Reviewed-on: http://review.gluster.org/13551
Smoke: Gluster Build System <jenkins@build.gluster.com>
CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Diffstat (limited to 'extras/hook-scripts')
| -rwxr-xr-x | extras/hook-scripts/add-brick/post/disabled-quota-root-xattr-heal.sh | 61 | 
1 files changed, 28 insertions, 33 deletions
diff --git a/extras/hook-scripts/add-brick/post/disabled-quota-root-xattr-heal.sh b/extras/hook-scripts/add-brick/post/disabled-quota-root-xattr-heal.sh index 5f143334358..bde7249d429 100755 --- a/extras/hook-scripts/add-brick/post/disabled-quota-root-xattr-heal.sh +++ b/extras/hook-scripts/add-brick/post/disabled-quota-root-xattr-heal.sh @@ -11,7 +11,8 @@  ## 4. Disable itself  ##--------------------------------------------------------------------------- -QUOTA_CONFIG_XATTR="trusted.glusterfs.quota.limit-set"; +QUOTA_LIMIT_XATTR="trusted.glusterfs.quota.limit-set" +QUOTA_OBJECT_LIMIT_XATTR="trusted.glusterfs.quota.limit-objects"  MOUNT_DIR=`mktemp -d -t ${0##*/}.XXXXXX`;  OPTSPEC="volname:,version:,gd-workdir:,volume-op:"  PROGNAME="Quota-xattr-heal-add-brick" @@ -47,6 +48,26 @@ disable_and_exit ()          exit 0  } +get_and_set_xattr () +{ +        XATTR=$1 + +        VALUE=$(getfattr -n $XATTR -e hex --absolute-names $MOUNT_DIR 2>&1) +        RET=$? +        if [ 0 -eq $RET ]; then +                VALUE=$(echo $VALUE | grep $XATTR | awk -F'=' '{print $NF}') +                setfattr -n $XATTR -v $VALUE $MOUNT_DIR; +                RET=$? +        else +                echo $VALUE | grep -iq "No such attribute" +                if [ 0 -eq $? ]; then +                        RET=0 +                fi +        fi + +        return $RET; +} +  ##------------------------------------------  ## Parse the arguments  ##------------------------------------------ @@ -101,40 +122,14 @@ then  fi  ## ----------------------------------- -## ------------------ -## Getfattr the value -## ------------------ -VALUE=$(getfattr -n $QUOTA_CONFIG_XATTR -e hex --absolute-names $MOUNT_DIR 2>&1) -RET=$? -if [ 0 -ne $RET ] -then -        ## Clean up and exit -        cleanup_mountpoint; - -        echo $VALUE | grep -iq "No such attribute" -        if [ 0 -eq $? ]; then -                disable_and_exit -        fi - -        exit $RET; -fi - -VALUE=$(echo $VALUE | grep $QUOTA_CONFIG_XATTR | awk -F'=' '{print $NF}') -## ------------------ +RET1=$(get_and_set_xattr $QUOTA_LIMIT_XATTR) +RET2=$(get_and_set_xattr $QUOTA_OBJECT_LIMIT_XATTR) -## --------- -## Set xattr -## --------- -setfattr -n "$QUOTA_CONFIG_XATTR" -v $VALUE $MOUNT_DIR; -RET=$? -if [ 0 -ne $RET ] -then -        ## Clean up and exit -        cleanup_mountpoint; +## Clean up and exit +cleanup_mountpoint; -        exit $RET; +if [ $RET1 -ne 0 -o $RET2 -ne 0 ]; then +        exit 1  fi -## --------- -cleanup_mountpoint;  disable_and_exit;  | 
