From 3dbd950b10154f7662bb3cfccedc98e95652c522 Mon Sep 17 00:00:00 2001 From: Kaushal M Date: Wed, 11 Sep 2013 13:50:40 +0530 Subject: cli: add aggregate status for rebalance and remove-brick status xml output Backport of 91e4b7aa1361087317238b9bf6427ef274737c8c from master 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'. BUG: 1006813 Change-Id: I803d4bfb31dbda53b5665332263576c910562805 Original-author: Timothy Asir Signed-off-by: Kaushal M Reviewed-on: http://review.gluster.org/5972 Tested-by: Gluster Build System Reviewed-by: Anand Avati --- cli/src/cli-xml-output.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (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 fded1c646a5..508828140fc 100644 --- a/cli/src/cli-xml-output.c +++ b/cli/src/cli-xml-output.c @@ -2887,6 +2887,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; @@ -2975,6 +2976,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); /* */ @@ -3003,7 +3010,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