summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/mgmt')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-bitrot.c29
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c16
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-rpc-ops.c1
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-syncop.c4
-rw-r--r--xlators/mgmt/glusterd/src/glusterd.h1
5 files changed, 47 insertions, 4 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:
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index bae9be872f4..b4eb8b13c66 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -714,6 +714,7 @@ glusterd_node_op_build_payload (glusterd_op_t op, gd1_mgmt_brick_op_req **req,
break;
case GD_OP_SCRUB_STATUS:
+ case GD_OP_SCRUB_ONDEMAND:
brick_req = GF_CALLOC (1, sizeof(*brick_req),
gf_gld_mt_mop_brick_req_t);
if (!brick_req)
@@ -4131,6 +4132,7 @@ glusterd_op_build_payload (dict_t **req, char **op_errstr, dict_t *op_ctx)
case GD_OP_BARRIER:
case GD_OP_BITROT:
case GD_OP_SCRUB_STATUS:
+ case GD_OP_SCRUB_ONDEMAND:
{
do_common = _gf_true;
}
@@ -4725,6 +4727,7 @@ glusterd_op_modify_op_ctx (glusterd_op_t op, void *ctx)
*/
case GD_OP_DEFRAG_BRICK_VOLUME:
case GD_OP_SCRUB_STATUS:
+ case GD_OP_SCRUB_ONDEMAND:
ret = dict_get_int32 (op_ctx, "count", &count);
if (ret) {
gf_msg_debug (this->name, 0,
@@ -4772,10 +4775,11 @@ glusterd_op_modify_op_ctx (glusterd_op_t op, void *ctx)
GD_MSG_CONVERSION_FAILED,
"Failed uuid to hostname conversion");
- /* Since Both rebalance and bitrot scrub status are going to
- * use same code path till here, we should break in case
- * of scrub status */
- if (op == GD_OP_SCRUB_STATUS) {
+ /* Since Both rebalance and bitrot scrub status/ondemand
+ * are going to use same code path till here, we should
+ * break in case of scrub status.
+ */
+ if (op == GD_OP_SCRUB_STATUS || op == GD_OP_SCRUB_ONDEMAND) {
break;
}
@@ -5442,6 +5446,7 @@ glusterd_need_brick_op (glusterd_op_t op)
case GD_OP_DEFRAG_BRICK_VOLUME:
case GD_OP_HEAL_VOLUME:
case GD_OP_SCRUB_STATUS:
+ case GD_OP_SCRUB_ONDEMAND:
ret = _gf_true;
break;
default:
@@ -5713,6 +5718,7 @@ glusterd_op_stage_validate (glusterd_op_t op, dict_t *dict, char **op_errstr,
case GD_OP_BITROT:
case GD_OP_SCRUB_STATUS:
+ case GD_OP_SCRUB_ONDEMAND:
ret = glusterd_op_stage_bitrot (dict, op_errstr,
rsp_dict);
break;
@@ -5838,6 +5844,7 @@ glusterd_op_commit_perform (glusterd_op_t op, dict_t *dict, char **op_errstr,
case GD_OP_BITROT:
case GD_OP_SCRUB_STATUS:
+ case GD_OP_SCRUB_ONDEMAND:
ret = glusterd_op_bitrot (dict, op_errstr, rsp_dict);
break;
@@ -7288,6 +7295,7 @@ glusterd_op_bricks_select (glusterd_op_t op, dict_t *dict, char **op_errstr,
ret = glusterd_bricks_select_snap (dict, op_errstr, selected);
break;
case GD_OP_SCRUB_STATUS:
+ case GD_OP_SCRUB_ONDEMAND:
ret = glusterd_bricks_select_scrub (dict, op_errstr, selected);
break;
default:
diff --git a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
index 890ccf06cdc..9cf6fda5152 100644
--- a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
@@ -143,6 +143,7 @@ glusterd_op_send_cli_response (glusterd_op_t op, int32_t op_ret,
case GD_OP_BARRIER:
case GD_OP_BITROT:
case GD_OP_SCRUB_STATUS:
+ case GD_OP_SCRUB_ONDEMAND:
{
/*nothing specific to be done*/
break;
diff --git a/xlators/mgmt/glusterd/src/glusterd-syncop.c b/xlators/mgmt/glusterd/src/glusterd-syncop.c
index 7c5721f25d0..7aeda77a59d 100644
--- a/xlators/mgmt/glusterd/src/glusterd-syncop.c
+++ b/xlators/mgmt/glusterd/src/glusterd-syncop.c
@@ -309,6 +309,10 @@ glusterd_syncop_aggr_rsp_dict (glusterd_op_t op, dict_t *aggr, dict_t *rsp)
case GD_OP_SCRUB_STATUS:
ret = glusterd_volume_bitrot_scrub_use_rsp_dict (aggr, rsp);
break;
+
+ case GD_OP_SCRUB_ONDEMAND:
+ break;
+
default:
break;
}
diff --git a/xlators/mgmt/glusterd/src/glusterd.h b/xlators/mgmt/glusterd/src/glusterd.h
index 77eded4f29c..c07fe42fe61 100644
--- a/xlators/mgmt/glusterd/src/glusterd.h
+++ b/xlators/mgmt/glusterd/src/glusterd.h
@@ -117,6 +117,7 @@ typedef enum glusterd_op_ {
GD_OP_DETACH_TIER,
GD_OP_TIER_MIGRATE,
GD_OP_SCRUB_STATUS,
+ GD_OP_SCRUB_ONDEMAND,
GD_OP_MAX,
} glusterd_op_t;