From bd772be0685479c2fe27e15a3289384a56cf4c31 Mon Sep 17 00:00:00 2001 From: Prasanna Kumar Kalever Date: Wed, 26 Apr 2017 12:43:35 +0530 Subject: 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 --- cli/gluster-block.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'cli') 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; -- cgit