diff options
author | Avra Sengupta <asengupt@redhat.com> | 2014-11-24 08:24:24 +0000 |
---|---|---|
committer | Krishnan Parthasarathi <kparthas@redhat.com> | 2014-11-30 23:09:44 -0800 |
commit | a93164cd2a7f7ec37cf30d52b1a73fdc211981c3 (patch) | |
tree | 637079704020927ecd961aaa951f3af17eb6d344 /xlators/mgmt/glusterd/src/glusterd-volgen.c | |
parent | 92242ecd1047fe23ca494555edd6033685522c82 (diff) |
glusterd/uss: Create rebalance volfile.
Create a new rebalance volfile, which will not contain
snap-view client translators, irrespective of the status
of USS.
This volfile, will be created and regenerated everytime
the fuse-volfile is generated, and will be consumed
by the rebalance process.
Change-Id: I514a8e88d06c0b8fb6949c3a3e6dc4dbe55e38af
BUG: 1164711
Signed-off-by: Avra Sengupta <asengupt@redhat.com>
Reviewed-on: http://review.gluster.org/9190
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
Tested-by: Krishnan Parthasarathi <kparthas@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-volgen.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-volgen.c | 61 |
1 files changed, 47 insertions, 14 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c index 247f369274f..b0c82632c45 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volgen.c +++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c @@ -2690,14 +2690,16 @@ static int client_graph_builder (volgen_graph_t *graph, glusterd_volinfo_t *volinfo, dict_t *set_dict, void *param) { - int ret = 0; - xlator_t *xl = NULL; - char *volname = NULL; - glusterd_conf_t *conf = THIS->private; - char *tmp = NULL; - gf_boolean_t var = _gf_false; - gf_boolean_t ob = _gf_false; - xlator_t *this = THIS; + int ret = 0; + xlator_t *xl = NULL; + char *volname = NULL; + glusterd_conf_t *conf = THIS->private; + char *tmp = NULL; + gf_boolean_t var = _gf_false; + gf_boolean_t ob = _gf_false; + gf_boolean_t uss_enabled = _gf_false; + gf_boolean_t rebal_volfile = _gf_false; + xlator_t *this = THIS; GF_ASSERT (this); GF_ASSERT (conf); @@ -2881,14 +2883,24 @@ client_graph_builder (volgen_graph_t *graph, glusterd_volinfo_t *volinfo, if (ret) goto out; - ret = dict_get_str_boolean (set_dict, "features.uss", _gf_false); - if (ret == -1) + uss_enabled = dict_get_str_boolean (set_dict, "features.uss", + _gf_false); + if (uss_enabled == -1) goto out; - if (ret && !volinfo->is_snap_volume) { - ret = volgen_graph_build_snapview_client - (graph, volinfo, volname, set_dict); - if (ret == -1) + if (uss_enabled && !volinfo->is_snap_volume) { + rebal_volfile = dict_get_str_boolean (set_dict, + "rebalance-volfile-creation", + _gf_false); + if (rebal_volfile == -1) goto out; + + if (!rebal_volfile) { + ret = volgen_graph_build_snapview_client + (graph, volinfo, + volname, set_dict); + if (ret == -1) + goto out; + } } /* add debug translators depending on the options */ @@ -3895,6 +3907,27 @@ generate_client_volfiles (glusterd_volinfo_t *volinfo, if (ret) goto out; } + + /* Generate volfile for rebalance process */ + ret = dict_set_int32 (dict, "rebalance-volfile-creation", _gf_true); + if (ret) { + gf_log (this->name, GF_LOG_ERROR, + "Failed to set rebalance-volfile-creation"); + goto out; + } + + glusterd_get_rebalance_volfile (volinfo, filepath, PATH_MAX); + + ret = generate_single_transport_client_volfile (volinfo, + filepath, + dict); + if (ret) { + gf_log (this->name, GF_LOG_ERROR, + "Failed to create rebalance volfile for %s", + volinfo->volname); + goto out; + } + out: if (dict) dict_unref (dict); |