diff options
| -rw-r--r-- | api/src/glfs-mgmt.c | 15 | ||||
| -rw-r--r-- | glusterfsd/src/glusterfsd-mgmt.c | 17 | ||||
| -rw-r--r-- | rpc/rpc-lib/src/rpc-transport.h | 5 | ||||
| -rw-r--r-- | rpc/rpc-transport/socket/src/socket.c | 2 | 
4 files changed, 31 insertions, 8 deletions
diff --git a/api/src/glfs-mgmt.c b/api/src/glfs-mgmt.c index 045080d667a..6b65e517a67 100644 --- a/api/src/glfs-mgmt.c +++ b/api/src/glfs-mgmt.c @@ -792,11 +792,16 @@ mgmt_rpc_notify (struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event,  	switch (event) {  	case RPC_CLNT_DISCONNECT:  		if (!ctx->active) { -                        gf_msg ("glfs-mgmt", GF_LOG_ERROR, errno, -                                API_MSG_REMOTE_HOST_CONN_FAILED, -                                "failed to connect with remote-host: %s (%s)", -                                ctx->cmd_args.volfile_server, -                                strerror (errno)); +                        if (rpc_trans->connect_failed) +                                gf_msg ("glfs-mgmt", GF_LOG_ERROR, 0, +                                        API_MSG_REMOTE_HOST_CONN_FAILED, +                                        "failed to connect to remote-host: %s", +                                        ctx->cmd_args.volfile_server); +                        else +                                gf_msg ("glfs-mgmt", GF_LOG_INFO, 0, +                                        API_MSG_REMOTE_HOST_CONN_FAILED, +                                        "disconnected from remote-host: %s", +                                        ctx->cmd_args.volfile_server);                          if (!rpc->disabled) {                                  /* diff --git a/glusterfsd/src/glusterfsd-mgmt.c b/glusterfsd/src/glusterfsd-mgmt.c index 6871582abb0..3f06893fafa 100644 --- a/glusterfsd/src/glusterfsd-mgmt.c +++ b/glusterfsd/src/glusterfsd-mgmt.c @@ -2100,9 +2100,20 @@ mgmt_rpc_notify (struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event,          switch (event) {          case RPC_CLNT_DISCONNECT: -                GF_LOG_OCCASIONALLY (log_ctr1, "glusterfsd-mgmt", GF_LOG_ERROR, -                        "failed to connect with remote-host: %s (%s)", -                        ctx->cmd_args.volfile_server, strerror (errno)); +                if (rpc_trans->connect_failed) { +                        GF_LOG_OCCASIONALLY (log_ctr1, "glusterfsd-mgmt", +                                             GF_LOG_ERROR, +                                             "failed to connect to remote-" +                                             "host: %s", +                                             ctx->cmd_args.volfile_server); +                } else { +                        GF_LOG_OCCASIONALLY (log_ctr1, "glusterfsd-mgmt", +                                             GF_LOG_INFO, +                                             "disconnected from remote-" +                                             "host: %s", +                                             ctx->cmd_args.volfile_server); +                } +                  if (!rpc->disabled) {                          /*                           * Check if dnscache is exhausted for current server diff --git a/rpc/rpc-lib/src/rpc-transport.h b/rpc/rpc-lib/src/rpc-transport.h index e3b630e2919..ff6567c198e 100644 --- a/rpc/rpc-lib/src/rpc-transport.h +++ b/rpc/rpc-lib/src/rpc-transport.h @@ -212,6 +212,11 @@ struct rpc_transport {          char                      *ssl_name;          dict_t                    *clnt_options; /* store options received from                                                    * client */ +        /* connect_failed: saves the connect() syscall status as socket_t +         * member holding connect() status can't be accessed by higher gfapi +         * layer or in client management notification handler functions +         */ +        gf_boolean_t               connect_failed;  };  struct rpc_transport_ops { diff --git a/rpc/rpc-transport/socket/src/socket.c b/rpc/rpc-transport/socket/src/socket.c index 0ee75951207..d062cbbc4fb 100644 --- a/rpc/rpc-transport/socket/src/socket.c +++ b/rpc/rpc-transport/socket/src/socket.c @@ -3146,6 +3146,7 @@ socket_connect (rpc_transport_t *this, int port)                          }                  } +                this->connect_failed = _gf_false;                  if (ign_enoent) {                          ret = connect_loop (priv->sock,                                              SA (&this->peerinfo.sockaddr), @@ -3169,6 +3170,7 @@ socket_connect (rpc_transport_t *this, int port)                          /* TBD: What about ENOENT, we will do getsockopt there                          as well, so how is that exempt from such a problem? */                          priv->connect_failed = 1; +                        this->connect_failed = _gf_true;                          goto handler;                  }  | 
