From 2dea3b34755d9af1d1c1ffe517c6a087cf44512a Mon Sep 17 00:00:00 2001 From: Kaushal M Date: Tue, 27 Mar 2012 15:52:47 +0530 Subject: cli,glusterd: more volume status improvements The major changes are, * "volume status" now supports getting details of the self-heal daemon processes for replica volumes. A new cli options "shd", similar to "nfs", has been introduced for this. "detail", "fd" and "clients" status ops are not supported for self-heal daemons. * The default/normal ouput of "volume status" has been enhanced to contain information about nfs-server and self-heal daemon processes as well. Some tweaks have been done to the cli output to show appropriate output. Also, changes have been done to rebalance/remove-brick status, so that hostnames are displayed instead of uuids. Change-Id: I3972396dcf72d45e14837fa5f9c7d62410901df8 BUG: 803676 Signed-off-by: Kaushal M Reviewed-on: http://review.gluster.com/3016 Tested-by: Gluster Build System Reviewed-by: Krishnan Parthasarathi Reviewed-by: Vijay Bellur --- cli/src/cli-xml-output.c | 42 ++++++++++++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 10 deletions(-) (limited to 'cli/src/cli-xml-output.c') diff --git a/cli/src/cli-xml-output.c b/cli/src/cli-xml-output.c index 7f8f9cfc45e..702a7f7feb1 100644 --- a/cli/src/cli-xml-output.c +++ b/cli/src/cli-xml-output.c @@ -189,7 +189,8 @@ out: int cli_xml_output_vol_status_common (xmlTextWriterPtr writer, dict_t *dict, - int brick_index, int *online) + int brick_index, int *online, + gf_boolean_t *node_present) { int ret = -1; char *hostname = NULL; @@ -201,8 +202,12 @@ cli_xml_output_vol_status_common (xmlTextWriterPtr writer, dict_t *dict, snprintf (key, sizeof (key), "brick%d.hostname", brick_index); ret = dict_get_str (dict, key, &hostname); - if (ret) + if (ret) { + *node_present = _gf_false; goto out; + } + *node_present = _gf_true; + ret = xmlTextWriterWriteFormatElement (writer, (xmlChar *)"hostname", "%s", hostname); XML_RET_CHECK_AND_GOTO (ret, out); @@ -1282,8 +1287,12 @@ cli_xml_output_vol_status (dict_t *dict, int op_ret, int op_errno, xmlBufferPtr buf = NULL; char *volname = NULL; int brick_count = 0; + int brick_index_max = -1; + int other_count = 0; + int index_max = 0; uint32_t cmd = GF_CLI_STATUS_NONE; int online = 0; + gf_boolean_t node_present = _gf_true; int i; ret = cli_begin_xml_output (&writer, &buf); @@ -1308,7 +1317,7 @@ cli_xml_output_vol_status (dict_t *dict, int op_ret, int op_errno, ret = dict_get_int32 (dict, "count", &brick_count); if (ret) goto out; - ret = xmlTextWriterWriteFormatElement (writer, (xmlChar *)"brickCount", + ret = xmlTextWriterWriteFormatElement (writer, (xmlChar *)"nodeCount", "%d", brick_count); if (ret) goto out; @@ -1317,15 +1326,28 @@ cli_xml_output_vol_status (dict_t *dict, int op_ret, int op_errno, if (ret) goto out; - for (i = 0; i < brick_count; i++) { - /* */ - ret = xmlTextWriterStartElement (writer, (xmlChar *)"brick"); + ret = dict_get_int32 (dict, "brick-index-max", &brick_index_max); + if (ret) + goto out; + ret = dict_get_int32 (dict, "other-count", &other_count); + if (ret) + goto out; + + index_max = brick_index_max + other_count; + + for (i = 0; i <= index_max; i++) { + /* */ + ret = xmlTextWriterStartElement (writer, (xmlChar *)"node"); XML_RET_CHECK_AND_GOTO (ret, out); ret = cli_xml_output_vol_status_common (writer, dict, i, - &online); - if (ret) - goto out; + &online, &node_present); + if (ret) { + if (node_present) + goto out; + else + continue; + } switch (cmd & GF_CLI_STATUS_MASK) { case GF_CLI_STATUS_DETAIL: @@ -1384,7 +1406,7 @@ cli_xml_output_vol_status (dict_t *dict, int op_ret, int op_errno, break; } - /* */ + /* */ ret = xmlTextWriterEndElement (writer); XML_RET_CHECK_AND_GOTO (ret, out); } -- cgit