diff options
author | Vijay Bellur <vbellur@redhat.com> | 2013-08-19 04:54:34 -0700 |
---|---|---|
committer | Gerrit Code Review <review@dev.gluster.org> | 2013-08-19 04:54:34 -0700 |
commit | 0092fe4ae00d1cb3becc70f7a6a36128884d3359 (patch) | |
tree | d9953210d37bef6cf0dc83a0e73e75b881d71f89 | |
parent | 7fb0c918ce389b1527e932a2feced15994e977e2 (diff) | |
parent | 5734c34be2ef046de1f717e59c931fb55e594d8a (diff) |
Merge "mgmt/glusterd: Correct auto variable initialization." into upstream_on_quota
-rwxr-xr-x | tests/basic/quota.t | 18 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-quota.c | 7 |
2 files changed, 18 insertions, 7 deletions
diff --git a/tests/basic/quota.t b/tests/basic/quota.t index 999b2a23..8d222829 100755 --- a/tests/basic/quota.t +++ b/tests/basic/quota.t @@ -11,12 +11,18 @@ TEST $CLI volume info; TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{1,2,3,4}; -function limit_on() +function hard_limit() { local QUOTA_PATH=$1; $CLI volume quota $V0 list $QUOTA_PATH | grep "$QUOTA_PATH" | awk '{print $2}' } +function soft_limit() +{ + local QUOTA_PATH=$1; + $CLI volume quota $V0 list $QUOTA_PATH | grep "$QUOTA_PATH" | awk '{print $3}' +} + function usage() { local QUOTA_PATH=$1; @@ -43,14 +49,16 @@ TEST $CLI volume quota $V0 limit-usage /test_dir 100MB TEST $CLI volume quota $V0 limit-usage /test_dir/in_test_dir 150MB -EXPECT "150.0MB" limit_on "/test_dir/in_test_dir"; +EXPECT "150.0MB" hard_limit "/test_dir/in_test_dir"; +EXPECT "80%" soft_limit "/test_dir/in_test_dir"; TEST $CLI volume quota $V0 remove /test_dir/in_test_dir -EXPECT "100.0MB" limit_on "/test_dir"; +EXPECT "100.0MB" hard_limit "/test_dir"; TEST $CLI volume quota $V0 limit-usage /test_dir 10MB -EXPECT "10.0MB" limit_on "/test_dir"; +EXPECT "10.0MB" hard_limit "/test_dir"; +EXPECT "80%" soft_limit "/test_dir"; TEST $CLI volume quota $V0 soft-timeout 0 TEST $CLI volume quota $V0 hard-timeout 0 @@ -91,7 +99,7 @@ TEST $CLI volume quota $V0 limit-usage /test_dir 100MB TEST $CLI volume quota $V0 limit-usage /test_dir/in_test_dir 150MB -EXPECT "150.0MB" limit_on "/test_dir/in_test_dir"; +EXPECT "150.0MB" hard_limit "/test_dir/in_test_dir"; ## ----------------------------- TEST $CLI volume quota $V0 disable diff --git a/xlators/mgmt/glusterd/src/glusterd-quota.c b/xlators/mgmt/glusterd/src/glusterd-quota.c index 0592585d..1be768af 100644 --- a/xlators/mgmt/glusterd/src/glusterd-quota.c +++ b/xlators/mgmt/glusterd/src/glusterd-quota.c @@ -604,10 +604,13 @@ glusterd_set_quota_limit (char *volname, char *path, char *hard_limit, * OR * change the data-types of hard_lim and soft_lim_percent to uint64_t */ - struct quota_limits { + typedef struct quota_limits { uint64_t hl; uint64_t sl; - } __attribute__ ((__packed__)) existing_limit, new_limit = {0,}; + } __attribute__ ((__packed__)) quota_limits_t; + + quota_limits_t existing_limit = {0,}; + quota_limits_t new_limit = {0,}; this = THIS; GF_ASSERT (this); |