diff options
author | Venky Shankar <vshankar@redhat.com> | 2015-03-13 22:00:22 +0530 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2015-03-24 10:26:15 -0700 |
commit | 31f841d6b35c242942b6bdcbfdc83cf548d5235a (patch) | |
tree | 450558d7e4b1788bb254b2117fef8cdc9b6f2033 /xlators/mgmt/glusterd/src/glusterd-bitrot.c | |
parent | 84db9f8271f150fbb6024186f7f681e941731280 (diff) |
cli/glusterd: CLI interface for BitRot detection
* BitRot enable/disable CLI per volume
* Volfile generation for Scrubber
* Relevant glusterd infrastructure
Change-Id: I1212af63f93ecc52b22ee6da920e1664f66a1e39
BUG: 1170075
Original-Author: Raghavendra Bhat <raghavendra@redhat.com>
Original-Author: Venky Shankar <vshankar@redhat.com>
Original-Author: Gaurav Kumar Garg <ggarg@redhat.com>
Original-Author: Anand Nekkunti <anekkunt@redhat.com>
Reviewed-on: http://review.gluster.org/9986
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-bitrot.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-bitrot.c | 48 |
1 files changed, 27 insertions, 21 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-bitrot.c b/xlators/mgmt/glusterd/src/glusterd-bitrot.c index 44fefe82b7e..5bd906312a4 100644 --- a/xlators/mgmt/glusterd/src/glusterd-bitrot.c +++ b/xlators/mgmt/glusterd/src/glusterd-bitrot.c @@ -192,6 +192,27 @@ out: return ret; } +gf_boolean_t +glusterd_all_volumes_with_bitrot_stopped () +{ + glusterd_conf_t *conf = THIS->private; + glusterd_volinfo_t *volinfo = NULL; + gf_boolean_t stopped = _gf_true; + + cds_list_for_each_entry (volinfo, &conf->volumes, vol_list) { + if (!glusterd_is_bitrot_enabled (volinfo)) + continue; + else if (volinfo->status != GLUSTERD_STATUS_STARTED) + continue; + else { + stopped = _gf_false; + break; + } + } + + return stopped; +} + static int glusterd_manage_bitrot (int opcode) { @@ -207,28 +228,13 @@ glusterd_manage_bitrot (int opcode) switch (opcode) { case GF_BITROT_OPTION_TYPE_ENABLE: - /* TO DO: - * Start bitd service. once bitd volfile generation patch - * merge or this patch become dependent of bitd volfile - * generation patch below comment will remove. - * http://review.gluster.org/#/c/9710/ - */ - /*ret = priv->bitd_svc.manager (&(priv->bitd_svc), - NULL, PROC_START);*/ case GF_BITROT_OPTION_TYPE_DISABLE: - - /* TO DO: - * Stop bitd service. once bitd volfile generation patch - * merge or this patch become dependent of bitd volfile - * generation patch below comment will remove. - * http://review.gluster.org/#/c/9710/ - */ - - /*if (glusterd_all_volumes_with_bitrot_stopped ()) - ret = glusterd_svc_stop (&(priv->bitd_svc), - SIGTERM); - */ - ret = 0; + ret = priv->bitd_svc.manager (&(priv->bitd_svc), + NULL, PROC_START_NO_WAIT); + if (ret) + break; + ret = priv->scrub_svc.manager (&(priv->scrub_svc), NULL, + PROC_START_NO_WAIT); break; default: ret = 0; |