From 91e4b7aa1361087317238b9bf6427ef274737c8c Mon Sep 17 00:00:00 2001 From: Timothy Asir Date: Wed, 11 Sep 2013 13:50:40 +0530 Subject: cli: add aggregate status for rebalance and remove-brick status xml output Add aggregate status information in section of gluster volume 'rebalance status' and 'remove-brick status cli xml output. The aggregate status determined based on the most critical level and the aggregate status will have 'Complete' only when all individual status are 'Complete'. Change-Id: Ie805b9dd52fd82fd277c3da9ee91cc8b6dea8212 BUG: 1006813 Signed-off-by: Timothy Asir Reviewed-on: http://review.gluster.org/4950 Tested-by: Gluster Build System Reviewed-by: Kaushal M --- cli/src/cli-xml-output.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/cli/src/cli-xml-output.c b/cli/src/cli-xml-output.c index 4daf83e1d..d9e972d04 100644 --- a/cli/src/cli-xml-output.c +++ b/cli/src/cli-xml-output.c @@ -2993,6 +2993,7 @@ cli_xml_output_vol_rebalance_status (xmlTextWriterPtr writer, dict_t *dict) uint64_t total_failures = 0; char key[1024] = {0,}; int i = 0; + int overall_status = -1; if (!dict) { ret = 0; @@ -3081,6 +3082,12 @@ cli_xml_output_vol_rebalance_status (xmlTextWriterPtr writer, dict_t *dict) (xmlChar *)"statusStr", "%s", cli_vol_task_status_str[status_rcd]); + if (-1 == overall_status) + overall_status = status_rcd; + else if ((GF_DEFRAG_STATUS_COMPLETE == overall_status || + status_rcd > overall_status) && + (status_rcd != GF_DEFRAG_STATUS_COMPLETE)) + overall_status = status_rcd; XML_RET_CHECK_AND_GOTO (ret, out); /* */ @@ -3109,7 +3116,14 @@ cli_xml_output_vol_rebalance_status (xmlTextWriterPtr writer, dict_t *dict) "%"PRIu64, total_failures); XML_RET_CHECK_AND_GOTO (ret, out); - // TODO : Aggregate status + ret = xmlTextWriterWriteFormatElement (writer,(xmlChar *)"status", + "%d", overall_status); + XML_RET_CHECK_AND_GOTO (ret, out); + + ret = xmlTextWriterWriteFormatElement (writer,(xmlChar *)"statusStr", + "%s", + cli_vol_task_status_str[overall_status]); + XML_RET_CHECK_AND_GOTO (ret, out); /* */ ret = xmlTextWriterEndElement (writer); -- cgit