From dba7332557fa0e8169c980b67a0f60a50f99bcf8 Mon Sep 17 00:00:00 2001 From: Vijay Bellur Date: Sat, 4 Sep 2010 12:49:16 +0000 Subject: cli: Add support for GET volume Signed-off-by: Vijay Bellur Signed-off-by: Vijay Bellur BUG: 971 (dynamic volume management) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=971 --- cli/src/cli3_1-cops.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'cli/src/cli3_1-cops.c') diff --git a/cli/src/cli3_1-cops.c b/cli/src/cli3_1-cops.c index 5bf0e3670a9..67d469209a8 100644 --- a/cli/src/cli3_1-cops.c +++ b/cli/src/cli3_1-cops.c @@ -249,7 +249,7 @@ gf_cli3_1_get_volume_cbk (struct rpc_req *req, struct iovec *iov, int ret = 0; dict_t *dict = NULL; char *volname = NULL; - int32_t i = 1; + int32_t i = 0; char key[1024] = {0,}; int32_t status = 0; int32_t type = 0; @@ -309,13 +309,20 @@ gf_cli3_1_get_volume_cbk (struct rpc_req *req, struct iovec *iov, local = ((call_frame_t *)myframe)->local; //cli_out ("Number of Volumes: %d", count); - if (!count) { + if (!count && (local->u.get_vol.flags == + GF_CLI_GET_NEXT_VOLUME)) { local->u.get_vol.volname = NULL; ret = 0; goto out; + } else if (!count && (local->u.get_vol.flags == + GF_CLI_GET_VOLUME)) { + cli_out ("Volume %s not present", + local->u.get_vol.volname); + ret = 0; + goto out; } - while ( i <= count) { + while ( i < count) { cli_out (""); snprintf (key, 256, "volume%d.name", i); ret = dict_get_str (dict, key, &volname); -- cgit