summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--rpc/rpc-lib/src/rpc-transport.c27
-rw-r--r--rpc/rpc-lib/src/rpc-transport.h2
-rw-r--r--rpc/rpc-transport/rdma/src/rdma.c2
-rw-r--r--xlators/mgmt/glusterd/src/glusterd.c22
-rw-r--r--xlators/protocol/server/src/server.c21
5 files changed, 72 insertions, 2 deletions
diff --git a/rpc/rpc-lib/src/rpc-transport.c b/rpc/rpc-lib/src/rpc-transport.c
index 266d07e99ed..f6774b72353 100644
--- a/rpc/rpc-lib/src/rpc-transport.c
+++ b/rpc/rpc-lib/src/rpc-transport.c
@@ -33,6 +33,31 @@
#define GF_OPTION_LIST_EMPTY(_opt) (_opt->value[0] == NULL)
#endif
+int32_t
+rpc_transport_count (const char *transport_type)
+{
+ char *transport_dup = NULL;
+ char *saveptr = NULL;
+ char *ptr = NULL;
+ int count = 0;
+
+ if (transport_type == NULL)
+ return -1;
+
+ transport_dup = gf_strdup (transport_type);
+ if (transport_dup == NULL) {
+ return -1;
+ }
+
+ ptr = strtok_r (transport_dup, ",", &saveptr);
+ while (ptr != NULL) {
+ count++;
+ ptr = strtok_r (NULL, ",", &saveptr);
+ }
+
+ GF_FREE (transport_dup);
+ return count;
+}
int
rpc_transport_get_myaddr (rpc_transport_t *this, char *peeraddr, int addrlen,
@@ -329,7 +354,7 @@ rpc_transport_load (glusterfs_ctx_t *ctx, dict_t *options, char *trans_name)
ret = trans->init (trans);
if (ret != 0) {
- gf_log ("rpc-transport", GF_LOG_ERROR,
+ gf_log ("rpc-transport", GF_LOG_WARNING,
"'%s' initialization failed", type);
goto fail;
}
diff --git a/rpc/rpc-lib/src/rpc-transport.h b/rpc/rpc-lib/src/rpc-transport.h
index 2beff0822a2..d1c650e7ec1 100644
--- a/rpc/rpc-lib/src/rpc-transport.h
+++ b/rpc/rpc-lib/src/rpc-transport.h
@@ -241,6 +241,8 @@ struct rpc_transport_ops {
int32_t (*throttle) (rpc_transport_t *this, gf_boolean_t onoff);
};
+int32_t
+rpc_transport_count (const char *transport_type);
int32_t
rpc_transport_listen (rpc_transport_t *this);
diff --git a/rpc/rpc-transport/rdma/src/rdma.c b/rpc/rpc-transport/rdma/src/rdma.c
index 92d5da258f2..d3b9c6354b4 100644
--- a/rpc/rpc-transport/rdma/src/rdma.c
+++ b/rpc/rpc-transport/rdma/src/rdma.c
@@ -4561,7 +4561,7 @@ init (rpc_transport_t *this)
this->private = priv;
if (gf_rdma_init (this)) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_log (this->name, GF_LOG_WARNING,
"Failed to initialize IB Device");
return -1;
}
diff --git a/xlators/mgmt/glusterd/src/glusterd.c b/xlators/mgmt/glusterd/src/glusterd.c
index ce312066379..d44040eb1b1 100644
--- a/xlators/mgmt/glusterd/src/glusterd.c
+++ b/xlators/mgmt/glusterd/src/glusterd.c
@@ -1198,7 +1198,9 @@ init (xlator_t *this)
int first_time = 0;
char *mountbroker_root = NULL;
int i = 0;
+ int total_transport = 0;
char *valgrind_str = NULL;
+ char *transport_type = NULL;
#ifndef GF_DARWIN_HOST_OS
{
@@ -1403,12 +1405,32 @@ init (xlator_t *this)
* only one (at most a pair - rdma and socket) listener for
* glusterd1_mop_prog, gluster_pmap_prog and gluster_handshake_prog.
*/
+
+ ret = dict_get_str (this->options, "transport-type", &transport_type);
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR, "Failed to get transport type");
+ ret = -1;
+ goto out;
+ }
+
+ total_transport = rpc_transport_count (transport_type);
+ if (total_transport <= 0) {
+ gf_log (this->name, GF_LOG_ERROR,
+ "failed to get total number of available tranpsorts");
+ ret = -1;
+ goto out;
+ }
+
ret = rpcsvc_create_listeners (rpc, this->options, this->name);
if (ret < 1) {
gf_log (this->name, GF_LOG_ERROR,
"creation of listener failed");
ret = -1;
goto out;
+ } else if (ret < total_transport) {
+ gf_log (this->name, GF_LOG_ERROR,
+ "creation of %d listeners failed, continuing with "
+ "succeeded transport", (total_transport - ret));
}
for (i = 0; i < gd_inet_programs_count; i++) {
diff --git a/xlators/protocol/server/src/server.c b/xlators/protocol/server/src/server.c
index e132cf33f85..97389116023 100644
--- a/xlators/protocol/server/src/server.c
+++ b/xlators/protocol/server/src/server.c
@@ -848,7 +848,10 @@ init (xlator_t *this)
int32_t ret = -1;
server_conf_t *conf = NULL;
rpcsvc_listener_t *listener = NULL;
+ char *transport_type = NULL;
char *statedump_path = NULL;
+ int total_transport = 0;
+
GF_VALIDATE_OR_GOTO ("init", this, out);
if (this->children == NULL) {
@@ -958,6 +961,20 @@ init (xlator_t *this)
*/
this->ctx->secure_srvr = MGMT_SSL_COPY_IO;
+ ret = dict_get_str (this->options, "transport-type", &transport_type);
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR,
+ "option transport-type not set");
+ ret = -1;
+ goto out;
+ }
+ total_transport = rpc_transport_count (transport_type);
+ if (total_transport <= 0) {
+ gf_log (this->name, GF_LOG_ERROR,
+ "failed to get total number of available tranpsorts");
+ ret = -1;
+ goto out;
+ }
ret = rpcsvc_create_listeners (conf->rpc, this->options,
this->name);
if (ret < 1) {
@@ -965,6 +982,10 @@ init (xlator_t *this)
"creation of listener failed");
ret = -1;
goto out;
+ } else if (ret < total_transport) {
+ gf_log (this->name, GF_LOG_ERROR,
+ "creation of %d listeners failed, continuing with "
+ "succeeded transport", (total_transport - ret));
}
ret = rpcsvc_register_notify (conf->rpc, server_rpc_notify, this);