summaryrefslogtreecommitdiffstats
path: root/cli/src/cli-rpc-ops.c
diff options
context:
space:
mode:
authorKrishnan Parthasarathi <kp@gluster.com>2011-10-31 15:54:52 +0530
committerVijay Bellur <vijay@gluster.com>2011-11-18 04:22:25 -0800
commit1e652740f74298637577e9861cb5092091404d29 (patch)
treedc2a50ba794396b493c57e0c8b244ba2543a4b55 /cli/src/cli-rpc-ops.c
parentc5be0df9149155f9e23a8e9f24d0becb0543efe1 (diff)
glusterd: Extended glusterd_is_service_running to get svcs's pid.
Also, volume status cmd would print "N/A" if pid couldn't be retrieved from pidfile. Change-Id: Ie83d228b1cf86397d181885b325e337a403e6ed2 BUG: 3043 Reviewed-on: http://review.gluster.com/650 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Amar Tumballi <amar@gluster.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'cli/src/cli-rpc-ops.c')
-rw-r--r--cli/src/cli-rpc-ops.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c
index 2841a32d589..8a88e57d595 100644
--- a/cli/src/cli-rpc-ops.c
+++ b/cli/src/cli-rpc-ops.c
@@ -3807,7 +3807,8 @@ gf_cli3_1_status_cbk (struct rpc_req *req, struct iovec *iov,
int port = 0;
int online = 0;
char key[1024] = {0,};
- int pid = 0;
+ int pid = -1;
+ char *pid_str = NULL;
char brick[8192] = {0,};
char *volname = NULL;
@@ -3875,11 +3876,22 @@ gf_cli3_1_status_cbk (struct rpc_req *req, struct iovec *iov,
memset (key, 0, sizeof (key));
snprintf (key, sizeof (key), "brick%d.pid", i);
ret = dict_get_int32 (dict, key, &pid);
+ if (ret)
+ goto out;
+ if (pid == -1)
+ ret = gf_asprintf (&pid_str, "%s", "N/A");
+ else
+ ret = gf_asprintf (&pid_str, "%d", pid);
+
+ if (ret == -1)
+ goto out;
snprintf (brick, sizeof (brick) -1, "%s:%s", hostname, path);
cli_print_line (CLI_BRICK_STATUS_LINE_LEN);
- cli_print_brick_status (brick, port, online, pid);
+ cli_print_brick_status (brick, port, online, pid_str);
+ if (pid_str)
+ GF_FREE (pid_str);
}
ret = rsp.op_ret;