summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/mgmt')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c31
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c22
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volgen.h1
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volume-set.c4
4 files changed, 56 insertions, 2 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index 10c2d175ff2..0e10b985aa6 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -1424,6 +1424,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);
}
@@ -1780,6 +1800,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)) {
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index dc800a1a520..17a8b06f433 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -9557,6 +9557,28 @@ glusterd_enable_default_options (glusterd_volinfo_t *volinfo, char *option)
}
}
+ /* Option 'features.quota-deem-statfs' should not be turned off
+ * with 'gluster volume reset <VOLNAME>', since quota features
+ * can be reset only with 'gluster volume quota <VOLNAME>
+ * disable'.
+ */
+
+ if (!option || !strcmp ("features.quota-deem-statfs", option)) {
+ if (glusterd_is_volume_quota_enabled(volinfo)) {
+ ret = dict_set_dynstr_with_alloc (volinfo->dict,
+ "features.quota-deem-statfs", "on");
+ if (ret) {
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_SET_FAILED,
+ "Failed to set option "
+ "'features.quota-deem-statfs' "
+ "on volume %s",
+ volinfo->volname);
+ goto out;
+ }
+ }
+ }
+
}
out:
return ret;
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.h b/xlators/mgmt/glusterd/src/glusterd-volgen.h
index dd46b07fa6e..2dccfca8407 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.h
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.h
@@ -92,6 +92,7 @@ typedef enum gd_volopt_flags_ {
OPT_FLAG_FORCE = 0x01, // option needs force to be reset
OPT_FLAG_XLATOR_OPT = 0x02, // option enables/disables xlators
OPT_FLAG_CLIENT_OPT = 0x04, // option affects clients
+ OPT_FLAG_NEVER_RESET = 0x08, /* option which should not be reset */
} gd_volopt_flags_t;
typedef enum {
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-set.c b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
index eb079d072b6..12bc04525e1 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volume-set.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
@@ -1408,7 +1408,7 @@ struct volopt_map_entry glusterd_volopt_map[] = {
.option = "quota",
.value = "off",
.type = NO_DOC,
- .flags = OPT_FLAG_FORCE,
+ .flags = OPT_FLAG_NEVER_RESET,
.op_version = 1
},
{ .key = VKEY_FEATURES_INODE_QUOTA,
@@ -1416,7 +1416,7 @@ struct volopt_map_entry glusterd_volopt_map[] = {
.option = "inode-quota",
.value = "off",
.type = NO_DOC,
- .flags = OPT_FLAG_FORCE,
+ .flags = OPT_FLAG_NEVER_RESET,
.op_version = 1
},