summaryrefslogtreecommitdiffstats
path: root/xlators/protocol/client
diff options
context:
space:
mode:
authorPoornima G <pgurusid@redhat.com>2018-01-26 15:34:43 +0530
committerAmar Tumballi <amarts@redhat.com>2018-01-30 05:00:52 +0000
commitd25b6065469eb978d40450b5aebcf5711fb50205 (patch)
treeae8cbb6dff9b7f1a0887b05adc57fa6ec96fa5e7 /xlators/protocol/client
parent9bbee1c2bc91d194d7470dfe2351b7d8c7abe102 (diff)
quiesce, gfproxy: Implement failover across multiple gfproxy nodes
Updates: #242 Change-Id: I767e574a26e922760a7130bd209c178d74e8cf69 Signed-off-by: Poornima G <pgurusid@redhat.com>
Diffstat (limited to 'xlators/protocol/client')
-rw-r--r--xlators/protocol/client/src/client.c80
-rw-r--r--xlators/protocol/client/src/client.h2
2 files changed, 34 insertions, 48 deletions
diff --git a/xlators/protocol/client/src/client.c b/xlators/protocol/client/src/client.c
index 74bf2104edc..32d5e65cf47 100644
--- a/xlators/protocol/client/src/client.c
+++ b/xlators/protocol/client/src/client.c
@@ -1121,10 +1121,6 @@ is_client_rpc_init_command (dict_t *dict, xlator_t *this,
gf_boolean_t ret = _gf_false;
int dict_ret = -1;
- if (!strstr (this->name, "replace-brick")) {
- gf_msg_trace (this->name, 0, "name is !replace-brick");
- goto out;
- }
dict_ret = dict_get_str (dict, CLIENT_CMD_CONNECT, value);
if (dict_ret) {
gf_msg_trace (this->name, 0, "key %s not present",
@@ -1165,7 +1161,7 @@ out:
}
-static gf_boolean_t
+static int
client_set_remote_options (char *value, xlator_t *this)
{
char *dup_value = NULL;
@@ -1176,56 +1172,53 @@ client_set_remote_options (char *value, xlator_t *this)
char *remote_port_str = NULL;
char *tmp = NULL;
int remote_port = 0;
- gf_boolean_t ret = _gf_false;
+ int ret = 0;
dup_value = gf_strdup (value);
host = strtok_r (dup_value, ":", &tmp);
subvol = strtok_r (NULL, ":", &tmp);
remote_port_str = strtok_r (NULL, ":", &tmp);
- if (!subvol) {
- gf_msg (this->name, GF_LOG_WARNING, EINVAL,
- PC_MSG_INVALID_ENTRY, "proper value not passed as "
- "subvolume");
- goto out;
- }
-
- host_dup = gf_strdup (host);
- if (!host_dup) {
- goto out;
- }
-
- ret = dict_set_dynstr (this->options, "remote-host", host_dup);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_DICT_SET_FAILED,
- "failed to set remote-host with %s", host);
- goto out;
+ if (host) {
+ host_dup = gf_strdup (host);
+ if (!host_dup) {
+ goto out;
+ }
+ ret = dict_set_dynstr (this->options, "remote-host", host_dup);
+ if (ret) {
+ gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_DICT_SET_FAILED,
+ "failed to set remote-host with %s", host);
+ goto out;
+ }
}
- subvol_dup = gf_strdup (subvol);
- if (!subvol_dup) {
- goto out;
- }
+ if (subvol) {
+ subvol_dup = gf_strdup (subvol);
+ if (!subvol_dup) {
+ goto out;
+ }
- ret = dict_set_dynstr (this->options, "remote-subvolume", subvol_dup);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_DICT_SET_FAILED,
- "failed to set remote-host with %s", host);
- goto out;
+ ret = dict_set_dynstr (this->options, "remote-subvolume", subvol_dup);
+ if (ret) {
+ gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_DICT_SET_FAILED,
+ "failed to set remote-host with %s", host);
+ goto out;
+ }
}
- remote_port = atoi (remote_port_str);
- GF_ASSERT (remote_port);
+ if (remote_port_str) {
+ remote_port = atoi (remote_port_str);
- ret = dict_set_int32 (this->options, "remote-port",
- remote_port);
- if (ret) {
- gf_msg (this->name, GF_LOG_ERROR, 0, PC_MSG_DICT_SET_FAILED,
- "failed to set remote-port to %d", remote_port);
- goto out;
+ ret = dict_set_int32 (this->options, "remote-port",
+ remote_port);
+ if (ret) {
+ gf_msg (this->name, GF_LOG_ERROR, 0, PC_MSG_DICT_SET_FAILED,
+ "failed to set remote-port to %d", remote_port);
+ goto out;
+ }
}
- ret = _gf_true;
+ ret = 0;
out:
GF_FREE (dup_value);
@@ -1252,11 +1245,6 @@ client_setxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *dict,
gf_msg (this->name, GF_LOG_INFO, 0, PC_MSG_RPC_INIT,
"client rpc init command");
ret = client_set_remote_options (value, this);
- if (ret) {
- (void) client_destroy_rpc (this);
- ret = client_init_rpc (this);
- }
-
if (!ret) {
op_ret = 0;
op_errno = 0;
diff --git a/xlators/protocol/client/src/client.h b/xlators/protocol/client/src/client.h
index 207c778c20c..b51607fdc45 100644
--- a/xlators/protocol/client/src/client.h
+++ b/xlators/protocol/client/src/client.h
@@ -27,8 +27,6 @@
#include "client-messages.h"
/* FIXME: Needs to be defined in a common file */
-#define CLIENT_CMD_CONNECT "trusted.glusterfs.client-connect"
-#define CLIENT_CMD_DISCONNECT "trusted.glusterfs.client-disconnect"
#define CLIENT_DUMP_LOCKS "trusted.glusterfs.clientlk-dump"
#define GF_MAX_SOCKET_WINDOW_SIZE (1 * GF_UNIT_MB)
#define GF_MIN_SOCKET_WINDOW_SIZE (0)