diff options
author | Manikandan Selvaganesh <mselvaga@redhat.com> | 2015-08-05 19:23:01 +0530 |
---|---|---|
committer | Raghavendra G <rgowdapp@redhat.com> | 2015-08-12 04:46:55 -0700 |
commit | 13061c8006471c87ff92007c8decc5586c600f0f (patch) | |
tree | 3647ba090bd643fa9887ac059f156ddf286ad94e /xlators/mgmt/glusterd/src/glusterd-op-sm.c | |
parent | e7904592678d58123fd12c58dad5a95b4e8031cd (diff) |
quota : volume-reset shouldn't remove quota-deem-statfs
Volume-reset shouldn't remove quota-deem-statfs, unless
explicitly specified, when quota is enabled.
1) glusterd_op_stage_reset_volume ()
'gluster volume set/reset <VOLNAME>' features.quota/
features.inode-quota' should not be allowed as it is deprecated.
Setting and resetting quota/inode-quota features should be allowed
only through 'gluster volume quota <VOLNAME> enable/disable'.
2) glusterd_enable_default_options ()
Option 'features.quota-deem-statfs' should not be turned off
with 'gluster volume reset <VOLNAME>', since quota features
can be set/reset only with 'gluster volume quota <VOLNAME>
enable/disable'.
But, 'gluster volume set features.quota-deem-statfs'
can be turned on/off when quota is enabled.
Backport of http://review.gluster.org/#/c/11839/
Cherry picked from commit 1868be8a5c309da8d516624d4af3b3b97819a9eb
> Change-Id: Ib5aa00a4d8c82819c08dfc23e2a86f43ebc436c4
> BUG: 1250582
> Signed-off-by: Manikandan Selvaganesh <mselvaga@redhat.com>
> Reviewed-on: http://review.gluster.org/11839
> Tested-by: NetBSD Build System <jenkins@build.gluster.org>
> Tested-by: Gluster Build System <jenkins@build.gluster.com>
> Reviewed-by: Vijaikumar Mallikarjuna <vmallika@redhat.com>
> Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Change-Id: Ib5aa00a4d8c82819c08dfc23e2a86f43ebc436c4
BUG: 1252297
Signed-off-by: Manikandan Selvaganesh <mselvaga@redhat.com>
Reviewed-on: http://review.gluster.org/11879
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-op-sm.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-op-sm.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c index 8b54e6d872a..875e06bf036 100644 --- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c @@ -1428,6 +1428,26 @@ glusterd_op_stage_reset_volume (dict_t *dict, char **op_errstr) } else if (exists > 0) { if (key_fixed) key = key_fixed; + + /* 'gluster volume set/reset <VOLNAME> + * features.quota/features.inode-quota' should + * not be allowed as it is deprecated. + * Setting and resetting quota/inode-quota features + * should be allowed only through 'gluster volume quota + * <VOLNAME> enable/disable'. + * But, 'gluster volume set features.quota-deem-statfs' + * can be turned on/off when quota is enabled. + */ + + if (strcmp (VKEY_FEATURES_INODE_QUOTA, key) == 0 || + strcmp (VKEY_FEATURES_QUOTA, key) == 0) { + snprintf (msg, sizeof (msg), "'gluster volume " + "reset <VOLNAME> %s' is deprecated. " + "Use 'gluster volume quota <VOLNAME> " + "disable' instead.", key); + ret = -1; + goto out; + } ALL_VOLUME_OPTION_CHECK (volname, key, ret, op_errstr, out); } @@ -1784,6 +1804,17 @@ _delete_reconfig_opt (dict_t *this, char *key, data_t *value, void *data) GF_ASSERT (data); is_force = (int32_t*)data; + /* Keys which has the flag OPT_FLAG_NEVER_RESET + * should not be deleted + */ + + if (_gf_true == glusterd_check_voloption_flags (key, + OPT_FLAG_NEVER_RESET)) { + if (*is_force != 1) + *is_force = *is_force | GD_OP_PROTECTED; + goto out; + } + if (*is_force != 1) { if (_gf_true == glusterd_check_voloption_flags (key, OPT_FLAG_FORCE)) { |