summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-bitrot.c
diff options
context:
space:
mode:
authorKotresh HR <khiremat@redhat.com>2016-08-05 09:03:22 +0530
committerVijay Bellur <vbellur@redhat.com>2016-08-25 14:39:38 -0700
commit0b3e4130b576c11156d6327e4cc3c9310a74c143 (patch)
treef0fe66209f2bbd778d34a80a531b8add9c6175bc /xlators/mgmt/glusterd/src/glusterd-bitrot.c
parent218c9b033fa44eacbc27d87491abd830548b362e (diff)
feature/bitrot: Ondemand scrub option for bitrot
The bitrot scrubber takes 'hourly/daily/biweekly/monthly' as the values for 'scrub-frequency'. There is no way to schedule the scrubbing when the admin wants it. Ondemand scrubbing brings in the new option 'ondemand' with which the admin can start scrubbing ondemand. It starts the scrubbing immediately. Ondemand scrubbing is successful only if the scrubber is in 'Active (Idle)' (waiting for it's next frequency cycle to start scrubbing). It is not entertained when the scrubber is in 'Paused' or already running. Here is the command line syntax. gluster volume bitrot <vol name> scrub ondemand Change-Id: I84c28904367eed827a7dae8d6a535c14b28e9f4d BUG: 1366195 Signed-off-by: Kotresh HR <khiremat@redhat.com> Reviewed-on: http://review.gluster.org/15111 Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Venky Shankar <vshankar@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-bitrot.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-bitrot.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-bitrot.c b/xlators/mgmt/glusterd/src/glusterd-bitrot.c
index 6e91106c8e5..8c5ddfd7896 100644
--- a/xlators/mgmt/glusterd/src/glusterd-bitrot.c
+++ b/xlators/mgmt/glusterd/src/glusterd-bitrot.c
@@ -138,6 +138,34 @@ __glusterd_handle_bitrot (rpcsvc_request_t *req)
}
}
+ if (type == GF_BITROT_CMD_SCRUB_ONDEMAND) {
+ /* Backward compatibility handling for scrub status command*/
+ if (conf->op_version < GD_OP_VERSION_3_9_0) {
+ snprintf (msg, sizeof (msg), "Cannot execute command. "
+ "The cluster is operating at version %d. "
+ "Bitrot scrub ondemand command unavailable in "
+ "this version", conf->op_version);
+ ret = -1;
+ goto out;
+ }
+
+ ret = dict_get_str (dict, "scrub-value", &scrub);
+ if (ret) {
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_GET_FAILED,
+ "Failed to get scrub value.");
+ ret = -1;
+ goto out;
+ }
+
+ if (!strncmp (scrub, "ondemand", strlen ("ondemand"))) {
+ ret = glusterd_op_begin_synctask (req,
+ GD_OP_SCRUB_ONDEMAND,
+ dict);
+ goto out;
+ }
+ }
+
ret = glusterd_op_begin_synctask (req, GD_OP_BITROT, dict);
out:
@@ -572,6 +600,7 @@ glusterd_op_bitrot (dict_t *dict, char **op_errstr, dict_t *rsp_dict)
if (ret)
goto out;
case GF_BITROT_CMD_SCRUB_STATUS:
+ case GF_BITROT_CMD_SCRUB_ONDEMAND:
break;
default: