diff options
author | Rajesh Amaravathi <rajesh@redhat.com> | 2011-12-07 20:51:03 +0530 |
---|---|---|
committer | Vijay Bellur <vijay@gluster.com> | 2012-01-12 01:58:26 -0800 |
commit | 169c73f28dae61236de54889edcaa8236d91da59 (patch) | |
tree | a4d74fc14c9198cbc78633a844480ab6c4ffdda3 /xlators/mgmt/glusterd/src/glusterd-handler.c | |
parent | 4e40a7e48757feedc959c7982acf05c73f739a15 (diff) |
cli: volume status enhancement
* Support "gluster volume status (all)" option to display all
volumes' status.
* On option "detail" appended to "gluster volume status *",
amount of storage free, total storage, and backend filesystem
details like inode size, inode count, free inodes, fs type,
device name of each brick is displayed.
* One can also obtain [detailed]status of only one brick.
* Format of the enhanced volume status command is:
"gluster volume status [all|<vol>] [<brick>] [detail]"
* Some generic functions have been added to common-utils:
skipword
get_nth_word
These functions enable parsing and fetching
of words in a sentence.
glusterd_get_brick_root (in glusterd)
These are self explanatory.
Change-Id: I6f40c1e19810f8504cd3b1786207364053d82e28
BUG: 765464
Signed-off-by: Rajesh Amaravathi <rajesh@redhat.com>
Reviewed-on: http://review.gluster.com/777
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amar@gluster.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-handler.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-handler.c | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c index 664798ca3..7817e1dd6 100644 --- a/xlators/mgmt/glusterd/src/glusterd-handler.c +++ b/xlators/mgmt/glusterd/src/glusterd-handler.c @@ -2511,10 +2511,11 @@ int glusterd_handle_status_volume (rpcsvc_request_t *req) { int32_t ret = -1; + uint32_t cmd = 0; + dict_t *dict = NULL; + char *volname = 0; gf_cli_req cli_req = {{0,}}; - dict_t *dict = NULL; - glusterd_op_t cli_op = GD_OP_STATUS_VOLUME; - char *volname = 0; + glusterd_op_t cli_op = GD_OP_STATUS_VOLUME; GF_ASSERT (req); @@ -2530,7 +2531,7 @@ glusterd_handle_status_volume (rpcsvc_request_t *req) if (!dict) goto out; ret = dict_unserialize (cli_req.dict.dict_val, - cli_req.dict.dict_len, &dict); + cli_req.dict.dict_len, &dict); if (ret < 0) { gf_log (THIS->name, GF_LOG_ERROR, "failed to " "unserialize buffer"); @@ -2539,15 +2540,22 @@ glusterd_handle_status_volume (rpcsvc_request_t *req) } - ret = dict_get_str (dict, "volname", &volname); - if (ret) { - gf_log (THIS->name, GF_LOG_ERROR, "failed to get volname"); + ret = dict_get_uint32 (dict, "cmd", &cmd); + if (ret) goto out; - } - gf_log ("glusterd", GF_LOG_INFO, "Received status volume req " - "for volume %s", volname); + if (!(cmd & GF_CLI_STATUS_ALL)) { + ret = dict_get_str (dict, "volname", &volname); + if (ret) { + gf_log (THIS->name, GF_LOG_ERROR, + "failed to get volname"); + goto out; + } + gf_log (THIS->name, GF_LOG_INFO, + "Received status volume req " + "for volume %s", volname); + } ret = glusterd_op_begin (req, GD_OP_STATUS_VOLUME, dict); |