From 0fe5ab5b9215b8f0ecfb8bc4ba15a5370850654a Mon Sep 17 00:00:00 2001 From: Varun Shastry Date: Tue, 6 May 2014 12:39:20 +0000 Subject: glusterd: Changes to provide interface for USS The changes which consists of the translators for the USS (User Servicable Snapshots) is submitted as a separate patch. Current patch provides the CLI access to the feature. Change-Id: I6b98a42fcfa82f0870d8048fe0bb53141565e9c6 BUG: 1094815 Signed-off-by: Varun Shastry Reviewed-on: http://review.gluster.org/7705 Tested-by: Gluster Build System Reviewed-by: Atin Mukherjee Reviewed-by: Krishnan Parthasarathi Tested-by: Krishnan Parthasarathi --- xlators/protocol/client/src/client.c | 39 ++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'xlators/protocol') diff --git a/xlators/protocol/client/src/client.c b/xlators/protocol/client/src/client.c index e181292f433..7ab10b085b4 100644 --- a/xlators/protocol/client/src/client.c +++ b/xlators/protocol/client/src/client.c @@ -2309,6 +2309,37 @@ notify (xlator_t *this, int32_t event, void *data, ...) return 0; } +int +client_check_remote_host (xlator_t *this, dict_t *options) +{ + char *remote_host = NULL; + int ret = -1; + + ret = dict_get_str (options, "remote-host", &remote_host); + if (ret < 0) { + gf_log (this->name, GF_LOG_INFO, "Remote host is not set. " + "Assuming the volfile server as remote host."); + + if (!this->ctx->cmd_args.volfile_server) { + gf_log (this->name, GF_LOG_ERROR, + "No remote host to connect."); + goto out; + } + + ret = dict_set_str (options, "remote-host", + this->ctx->cmd_args.volfile_server); + if (ret == -1) { + gf_log (this->name, GF_LOG_ERROR, + "Failed to set the remote host"); + goto out; + } + } + + ret = 0; +out: + return ret; +} + int build_client_config (xlator_t *this, clnt_conf_t *conf) { @@ -2337,6 +2368,10 @@ build_client_config (xlator_t *this, clnt_conf_t *conf) GF_OPTION_INIT ("send-gids", conf->send_gids, bool, out); + ret = client_check_remote_host (this, this->options); + if (ret) + goto out; + ret = 0; out: return ret; @@ -2493,6 +2528,10 @@ reconfigure (xlator_t *this, dict_t *options) GF_OPTION_RECONF ("ping-timeout", conf->opt.ping_timeout, options, int32, out); + ret = client_check_remote_host (this, options); + if (ret) + goto out; + subvol_ret = dict_get_str (this->options, "remote-host", &old_remote_host); -- cgit