diff options
| author | Mohammed Rafi KC <rkavunga@redhat.com> | 2015-11-24 20:59:29 +0530 | 
|---|---|---|
| committer | Dan Lambright <dlambrig@redhat.com> | 2015-12-02 05:50:37 -0800 | 
| commit | 803fb5df1022c684e7cdcf135f9199cb80d398fa (patch) | |
| tree | 8d8aacdce79141ff6b249690e7ba995ea8e68794 | |
| parent | 41d84bb6256bdd17df09cce3d51a89d44c117bab (diff) | |
glusterd/tier: Reset to reconfigured values after detach-tier
After detach-tier commit , we have to reset the option
reconfigured for tier volume
Backport of>
>Change-Id: Iae0210259720d6ac14ccc0cc339dc9f54a0c4571
>BUG: 1285046
>Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com>
>Reviewed-on: http://review.gluster.org/12736
>Tested-by: NetBSD Build System <jenkins@build.gluster.org>
>Tested-by: Gluster Build System <jenkins@build.gluster.com>
>Reviewed-by: Dan Lambright <dlambrig@redhat.com>
>Tested-by: Dan Lambright <dlambrig@redhat.com>
Change-Id: Ie11b15bc63ed462578daeb75b5188f7217479eba
BUG: 1285978
Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com>
Reviewed-on: http://review.gluster.org/12775
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Reviewed-by: Dan Lambright <dlambrig@redhat.com>
Tested-by: Dan Lambright <dlambrig@redhat.com>
| -rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-brick-ops.c | 33 | ||||
| -rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.c | 20 | ||||
| -rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.h | 3 | ||||
| -rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-volume-ops.c | 21 | 
4 files changed, 57 insertions, 20 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c index 15738dfa18a..f90d3d6584c 100644 --- a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c +++ b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c @@ -2353,6 +2353,10 @@ glusterd_op_remove_brick (dict_t *dict, char **op_errstr)          int                      defrag_cmd    = 0;          int                      detach_commit = 0;          void                    *tier_info     = NULL; +        char                    *cold_shd_key  = NULL; +        char                    *hot_shd_key   = NULL; +        int                      delete_key    = 1; +          this = THIS;          GF_ASSERT (this); @@ -2477,6 +2481,35 @@ glusterd_op_remove_brick (dict_t *dict, char **op_errstr)          case GF_OP_CMD_DETACH_COMMIT_FORCE:                  glusterd_op_perform_detach_tier (volinfo);                  detach_commit = 1; + +                /* Disabling ctr when detaching a tier, since +                 * currently tier is the only consumer of ctr. +                 * Revisit this code when this constraint no +                 * longer exist. +                 */ +                dict_del (volinfo->dict, "features.ctr-enabled"); +                dict_del (volinfo->dict, "cluster.tier-mode"); + +                hot_shd_key = gd_get_shd_key (volinfo->tier_info.hot_type); +                cold_shd_key = gd_get_shd_key (volinfo->tier_info.cold_type); +                if (hot_shd_key) { +                        /* +                         * Since post detach, shd graph will not contain hot +                         * tier. So we need to clear option set for hot tier. +                         * For a tiered volume there can be different key +                         * for both hot and cold. If hot tier is shd compatible +                         * then we need to remove the configured value when +                         * detaching a tier, only if the key's are different or +                         * cold key is NULL. So we will set delete_key first, +                         * and if cold key is not null and they are equal then +                         * we will clear the flag. Otherwise we will delete the +                         * key. +                         */ +                        if (cold_shd_key) +                                delete_key = strcmp (hot_shd_key, cold_shd_key); +                        if (delete_key) +                                dict_del (volinfo->dict, hot_shd_key); +               }                  /* fall through */          case GF_OP_CMD_COMMIT_FORCE: diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index 6cde0e6761f..75cb34baf37 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -10753,3 +10753,23 @@ glusterd_count_connected_peers (int32_t *count)  out:          return ret;  } + +char* +gd_get_shd_key (int type) +{ +        char            *key               = NULL; + +        switch (type) { +        case GF_CLUSTER_TYPE_REPLICATE: +        case GF_CLUSTER_TYPE_STRIPE_REPLICATE: +                key = "cluster.self-heal-daemon"; +                break; +        case GF_CLUSTER_TYPE_DISPERSE: +                key = "cluster.disperse-self-heal-daemon"; +                break; +        default: +                key = NULL; +                break; +        } +        return key; +} diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.h b/xlators/mgmt/glusterd/src/glusterd-utils.h index 8bc82f663e7..d0fce5efb89 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.h +++ b/xlators/mgmt/glusterd/src/glusterd-utils.h @@ -70,6 +70,9 @@ glusterd_unlock (uuid_t owner);  int32_t  glusterd_get_uuid (uuid_t *uuid); +char* +gd_get_shd_key (int type); +  int  glusterd_submit_reply (rpcsvc_request_t *req, void *arg,                         struct iovec *payload, int payloadcount, diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c index 683935e08a2..60ed3ccb677 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c +++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c @@ -694,26 +694,7 @@ glusterd_handle_cli_delete_volume (rpcsvc_request_t *req)          return glusterd_big_locked_handler (req,                                              __glusterd_handle_cli_delete_volume);  } -static char* -gd_get_shd_key (int type) -{ -        char            *key               = NULL; - -        switch (type) { -        case GF_CLUSTER_TYPE_REPLICATE: -        case GF_CLUSTER_TYPE_STRIPE_REPLICATE: -                key = "cluster.self-heal-daemon"; -                break; -        case GF_CLUSTER_TYPE_DISPERSE: -                key = "cluster.disperse-self-heal-daemon"; -                break; -        default: -                key = NULL; -                break; -        } -        return key; -} -static int +int  glusterd_handle_shd_option_for_tier (glusterd_volinfo_t *volinfo,                                       char *value, dict_t *dict)  {  | 
