From 169c73f28dae61236de54889edcaa8236d91da59 Mon Sep 17 00:00:00 2001 From: Rajesh Amaravathi Date: Wed, 7 Dec 2011 20:51:03 +0530 Subject: 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|] [] [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 Reviewed-on: http://review.gluster.com/777 Tested-by: Gluster Build System Reviewed-by: Amar Tumballi --- cli/src/cli.h | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'cli/src/cli.h') diff --git a/cli/src/cli.h b/cli/src/cli.h index 1d2e06973..e091e7004 100644 --- a/cli/src/cli.h +++ b/cli/src/cli.h @@ -37,7 +37,7 @@ #define DEFAULT_CLI_LOG_FILE_DIRECTORY DATADIR "/log/glusterfs" #define CLI_VOL_STATUS_BRICK_LEN 55 #define CLI_TAB_LENGTH 8 -#define CLI_BRICK_STATUS_LINE_LEN 75 +#define CLI_BRICK_STATUS_LINE_LEN 78 enum argp_option_keys { ARGP_DEBUG_KEY = 133, @@ -124,6 +124,24 @@ struct cli_local { dict_t *dict; }; +struct cli_volume_status { + int port; + int online; + uint64_t block_size; + uint64_t total_inodes; + uint64_t free_inodes; + char *brick; + char *pid_str; + char *fs_name; + char *free; + char *total; + char *mount_options; + char *device; + char *inode_size; +}; + +typedef struct cli_volume_status cli_volume_status_t; + typedef struct cli_local cli_local_t; typedef ssize_t (*cli_serialize_t) (struct iovec outmsg, void *args); @@ -236,7 +254,13 @@ cli_cmd_volume_status_parse (const char **words, int wordcount, dict_t **options); int -cli_print_brick_status (char *brick, int port, int online, char *pid); +cli_print_brick_status (cli_volume_status_t *status); + +void +cli_print_detailed_status (cli_volume_status_t *status); + +int +cli_get_detail_status (dict_t *dict, int i, cli_volume_status_t *status); void cli_print_line (int len); -- cgit