summaryrefslogtreecommitdiffstats
path: root/glusterfsd
diff options
context:
space:
mode:
Diffstat (limited to 'glusterfsd')
-rw-r--r--glusterfsd/src/glusterfsd-messages.h4
-rw-r--r--glusterfsd/src/glusterfsd-mgmt.c24
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);