diff options
author | Kotresh HR <khiremat@redhat.com> | 2016-08-05 09:03:22 +0530 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2016-08-25 14:39:38 -0700 |
commit | 0b3e4130b576c11156d6327e4cc3c9310a74c143 (patch) | |
tree | f0fe66209f2bbd778d34a80a531b8add9c6175bc /glusterfsd | |
parent | 218c9b033fa44eacbc27d87491abd830548b362e (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 'glusterfsd')
-rw-r--r-- | glusterfsd/src/glusterfsd-messages.h | 4 | ||||
-rw-r--r-- | glusterfsd/src/glusterfsd-mgmt.c | 24 |
2 files changed, 25 insertions, 3 deletions
diff --git a/glusterfsd/src/glusterfsd-messages.h b/glusterfsd/src/glusterfsd-messages.h index caa999506e6..e9c28f71263 100644 --- a/glusterfsd/src/glusterfsd-messages.h +++ b/glusterfsd/src/glusterfsd-messages.h @@ -36,7 +36,7 @@ */ #define GLFS_COMP_BASE GLFS_MSGID_COMP_GLUSTERFSD -#define GLFS_NUM_MESSAGES 36 +#define GLFS_NUM_MESSAGES 37 #define GLFS_MSGID_END (GLFS_COMP_BASE + GLFS_NUM_MESSAGES + 1) /* Messaged with message IDs */ #define glfs_msg_start_x GLFS_COMP_BASE, "Invalid: Start of messages" @@ -108,6 +108,8 @@ " unserialization failed." #define glusterfsd_msg_36 (GLFS_COMP_BASE + 36), "problem in xlator " \ " loading." +#define glusterfsd_msg_37 (GLFS_COMP_BASE + 37), "failed to get dict value" + /*------------*/ #define glfs_msg_end_x GLFS_MSGID_END, "Invalid: End of messages" diff --git a/glusterfsd/src/glusterfsd-mgmt.c b/glusterfsd/src/glusterfsd-mgmt.c index 51680e68b67..294c6818819 100644 --- a/glusterfsd/src/glusterfsd-mgmt.c +++ b/glusterfsd/src/glusterfsd-mgmt.c @@ -669,6 +669,7 @@ glusterfs_handle_bitrot (rpcsvc_request_t *req) char xname[1024] = {0,}; glusterfs_ctx_t *ctx = NULL; glusterfs_graph_t *active = NULL; + char *scrub_opt = NULL; GF_ASSERT (req); this = THIS; @@ -722,8 +723,27 @@ glusterfs_handle_bitrot (rpcsvc_request_t *req) goto out; } - ret = xlator->notify (xlator, GF_EVENT_SCRUB_STATUS, input, - output); + ret = dict_get_str (input, "scrub-value", &scrub_opt); + if (ret) { + snprintf (msg, sizeof (msg), "Failed to get scrub value"); + gf_msg (this->name, GF_LOG_ERROR, 0, glusterfsd_msg_37); + ret = -1; + goto out; + } + + if (!strncmp (scrub_opt, "status", strlen ("status"))) { + ret = xlator->notify (xlator, GF_EVENT_SCRUB_STATUS, input, + output); + } else if (!strncmp (scrub_opt, "ondemand", strlen ("ondemand"))) { + ret = xlator->notify (xlator, GF_EVENT_SCRUB_ONDEMAND, input, + output); + if (ret == -2) { + snprintf (msg, sizeof (msg), "Scrubber is in " + "Pause/Inactive/Running state"); + ret = -1; + goto out; + } + } out: glusterfs_translator_info_response_send (req, ret, msg, output); |