From 26800453aacd76e6edc36c078aaacbe7c16aa75e Mon Sep 17 00:00:00 2001 From: Kaushal M Date: Wed, 15 Feb 2012 16:18:25 +0530 Subject: cli: Enable output in XML This patch enables gluster cli to output data in xml format. XML output can be obtained by passing "--xml" as an argument. A new "volume list" command, which lists the volumes present in a cluster, has been added. This can be used for obtaining a quick list of volumes. Several commands, including "volume top", "volume profile", "volume status" and "volume info", "volume list", have custom XML output routines. Other commands use either one of the 2 generic output routines, cli_xml_output_str() & cli_xml_output_dict(). NOTE: When using "all" for "volume status" and "volume info" the XML output will have multiple roots. Change-Id: I6117baa02ec06fda116177dbd401f66521263ac6 BUG: 790713 Signed-off-by: Kaushal M Reviewed-on: http://review.gluster.com/2753 Tested-by: Gluster Build System Reviewed-by: Amar Tumballi Reviewed-by: Vijay Bellur --- cli/src/cli.h | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'cli/src/cli.h') diff --git a/cli/src/cli.h b/cli/src/cli.h index e091e7004..0814065a0 100644 --- a/cli/src/cli.h +++ b/cli/src/cli.h @@ -46,7 +46,7 @@ enum argp_option_keys { #define GLUSTER_MODE_SCRIPT (1 << 0) #define GLUSTER_MODE_ERR_FATAL (1 << 1) - +#define GLUSTER_MODE_XML (1 << 2) struct cli_state; struct cli_cmd_word; struct cli_cmd_tree; @@ -264,4 +264,28 @@ cli_get_detail_status (dict_t *dict, int i, cli_volume_status_t *status); void cli_print_line (int len); + +#if (HAVE_LIB_XML) +int +cli_xml_output_str (char *op, char *str, int op_ret, int op_errno, char *op_errstr); + +int +cli_xml_output_dict (char *op, dict_t *dict, int op_ret, int op_errno, char *op_errstr); + +int +cli_xml_output_vol_top (dict_t *dict, int op_ret, int op_errno, char *op_errstr); + +int +cli_xml_output_vol_profile (dict_t *dict, int op_ret, int op_errno, char *op_errstr); + +int +cli_xml_output_vol_status (dict_t *dict, int op_ret, int op_errno, char *op_errstr); + +int +cli_xml_output_vol_list (dict_t *dict, int op_ret, int op_errno, char *op_errstr); + +int +cli_xml_output_vol_info (dict_t *dict, int op_ret, int op_errno, char *op_errstr); +#endif + #endif /* __CLI_H__ */ -- cgit