summaryrefslogtreecommitdiffstats
path: root/cli
diff options
context:
space:
mode:
authorTimothy Asir <tjeyasin@redhat.com>2013-09-11 13:50:40 +0530
committerAnand Avati <avati@redhat.com>2013-09-18 09:00:59 -0700
commit91e4b7aa1361087317238b9bf6427ef274737c8c (patch)
tree377c5fcf32ed926164d715e0c646b421bfa5d448 /cli
parent67c28b19355c47e96d1420405cc38753a3e5f9be (diff)
cli: add aggregate status for rebalance and remove-brick status xml output
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'. Change-Id: Ie805b9dd52fd82fd277c3da9ee91cc8b6dea8212 BUG: 1006813 Signed-off-by: Timothy Asir <tjeyasin@redhat.com> Reviewed-on: http://review.gluster.org/4950 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Kaushal M <kaushal@redhat.com>
Diffstat (limited to 'cli')
-rw-r--r--cli/src/cli-xml-output.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/cli/src/cli-xml-output.c b/cli/src/cli-xml-output.c
index 4daf83e1dbf..d9e972d04f5 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);
/* </node> */
@@ -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);
/* </aggregate> */
ret = xmlTextWriterEndElement (writer);