diff options
author | Prasanna Kumar Kalever <prasanna.kalever@redhat.com> | 2017-04-26 12:43:35 +0530 |
---|---|---|
committer | Prasanna Kumar Kalever <prasanna.kalever@redhat.com> | 2017-04-26 12:51:50 +0530 |
commit | bd772be0685479c2fe27e15a3289384a56cf4c31 (patch) | |
tree | 903698433b11151e6fe8009706f494181e4ae073 /cli | |
parent | 310f79118b87bb77adb2cf40a4097bb687fa5392 (diff) |
cli: print clue if gluster-block daemon is not operational
Currently, if gluster-block daemon is not running, we just exit cli
commands with non-zero return value, not leaving any clue to user.
This patch will print some clue if daemon is not operational.
Change-Id: Id54db267894a92b3818b72f7fe654ecd87a3cf1b
Fixes: #14
Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
Diffstat (limited to 'cli')
-rw-r--r-- | cli/gluster-block.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/cli/gluster-block.c b/cli/gluster-block.c index bce0dce..5d9d413 100644 --- a/cli/gluster-block.c +++ b/cli/gluster-block.c @@ -65,6 +65,13 @@ glusterBlockCliRPC_1(void *cobj, clioperations opt, char **out) if (connect(sockfd, (struct sockaddr *) &saun, sizeof(struct sockaddr_un)) < 0) { + if (errno == ENOENT || errno == ECONNREFUSED) { + MSG("%s\n", "Connection failed. Please check if gluster-block daemon is operational."); + if (sockfd != -1) { + close (sockfd); + } + return -1; + } LOG("cli", GB_LOG_ERROR, "%s: connect failed (%s)", GB_UNIX_ADDRESS, strerror (errno)); goto out; |