From 7510d8edf4e7bea50e0c1f041202f063a5d138af Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Mon, 29 Dec 2014 15:32:28 +0530 Subject: mgmt/glusterd: Implement Volume heal enable/disable For volumes with replicate, disperse xlators, self-heal daemon should do healing. This patch provides enable/disable functionality for the xlators to be part of self-heal-daemon. Replicate already had this functionality with 'gluster volume set cluster.self-heal-daemon on/off'. But this patch makes it uniform for both types of volumes. Internally it still does 'volume set' based on the volume type. Change-Id: Ie0f3799b74c2afef9ac658ef3d50dce3e8072b29 BUG: 1177601 Signed-off-by: Pranith Kumar K Reviewed-on: http://review.gluster.org/9358 Reviewed-by: Krishnan Parthasarathi Tested-by: Gluster Build System Reviewed-by: Xavier Hernandez Tested-by: Krishnan Parthasarathi --- xlators/cluster/ec/src/ec.c | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) (limited to 'xlators/cluster/ec/src/ec.c') diff --git a/xlators/cluster/ec/src/ec.c b/xlators/cluster/ec/src/ec.c index bd3fbc717e5..9f620c75457 100644 --- a/xlators/cluster/ec/src/ec.c +++ b/xlators/cluster/ec/src/ec.c @@ -181,12 +181,18 @@ int32_t mem_acct_init(xlator_t * this) return 0; } -int32_t reconfigure(xlator_t * this, dict_t * options) +int32_t +reconfigure (xlator_t *this, dict_t *options) { - gf_log(this->name, GF_LOG_ERROR, "Online volume reconfiguration is not " - "supported."); + ec_t *ec = this->private; - return -1; + GF_OPTION_RECONF ("self-heal-daemon", ec->shd, options, bool, failed); + GF_OPTION_RECONF ("iam-self-heal-daemon", ec->iamshd, options, + bool, failed); + + return 0; +failed: + return -1; } void ec_up(xlator_t * this, ec_t * ec) @@ -336,9 +342,10 @@ int32_t notify(xlator_t * this, int32_t event, void * data, ...) return 0; } -int32_t init(xlator_t * this) +int32_t +init (xlator_t *this) { - ec_t * ec; + ec_t *ec = NULL; if (this->parents == NULL) { @@ -385,6 +392,8 @@ int32_t init(xlator_t * this) } ec_method_initialize(); + GF_OPTION_INIT ("self-heal-daemon", ec->shd, bool, failed); + GF_OPTION_INIT ("iam-self-heal-daemon", ec->iamshd, bool, failed); gf_log(this->name, GF_LOG_DEBUG, "Disperse translator initialized."); @@ -977,5 +986,18 @@ struct volume_options options[] = .description = "Maximum number of bricks that can fail " "simultaneously without losing data." }, + { + .key = { "self-heal-daemon" }, + .type = GF_OPTION_TYPE_BOOL, + .description = "self-heal daemon enable/disable", + .default_value = "enable", + }, + { .key = {"iam-self-heal-daemon"}, + .type = GF_OPTION_TYPE_BOOL, + .default_value = "off", + .description = "This option differentiates if the disperse " + "translator is running as part of self-heal-daemon " + "or not." + }, { } }; -- cgit