diff options
author | Kaushal M <kaushal@redhat.com> | 2013-09-11 13:50:40 +0530 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2013-09-19 14:07:45 -0700 |
commit | 3dbd950b10154f7662bb3cfccedc98e95652c522 (patch) | |
tree | 675ebc2e857c36645c5ec116781a9d89affab167 | |
parent | ac92dccc8727acaa3c9e9353fba80817947552bf (diff) |
cli: add aggregate status for rebalance and remove-brick status xml output
Backport of 91e4b7aa1361087317238b9bf6427ef274737c8c from master
Add aggregate status information in <aggregate> 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 <tjeyasin@redhat.com>
Signed-off-by: Kaushal M <kaushal@redhat.com>
Reviewed-on: http://review.gluster.org/5972
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
-rw-r--r-- | cli/src/cli-xml-output.c | 16 |
1 files changed, 15 insertions, 1 deletions
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); /* </node> */ @@ -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); /* </aggregate> */ ret = xmlTextWriterEndElement (writer); |