From bc9f0bb5ce108cba7e88be123681e2c269da31b7 Mon Sep 17 00:00:00 2001 From: Kaushal M Date: Tue, 12 Nov 2013 15:08:26 +0530 Subject: cli: List only nodes which have rebalance started in rebalance status Listing the nodes on which rebalance hasn't been started is just giving out extraneous information. Also, refactor the rebalance status printing code into a single function and use it for both rebalance and remove-brick status. BUG: 1031887 Change-Id: I47bd561347dfd6ef76c52a1587916d6a71eac369 Signed-off-by: Kaushal M Reviewed-on: http://review.gluster.org/6300 Tested-by: Gluster Build System Reviewed-by: Krutika Dhananjay Reviewed-by: Anand Avati --- cli/src/cli-xml-output.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 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 0dc0b8ab4..6c7bc1752 100644 --- a/cli/src/cli-xml-output.c +++ b/cli/src/cli-xml-output.c @@ -3122,6 +3122,16 @@ cli_xml_output_vol_rebalance_status (xmlTextWriterPtr writer, dict_t *dict, while (i < count) { i++; + /* Getting status early, to skip nodes that don't have the + * rebalance process started + */ + memset (key, 0, sizeof (key)); + snprintf (key, sizeof (key), "status-%d", i); + ret = dict_get_int32 (dict, key, &status_rcd); + if (ret) + goto out; + if (GF_DEFRAG_STATUS_NOT_STARTED == status_rcd) + continue; /* */ ret = xmlTextWriterStartElement (writer, (xmlChar *)"node"); @@ -3211,11 +3221,6 @@ cli_xml_output_vol_rebalance_status (xmlTextWriterPtr writer, dict_t *dict, "%"PRIu64, skipped); XML_RET_CHECK_AND_GOTO (ret, out); - memset (key, 0, sizeof (key)); - snprintf (key, sizeof (key), "status-%d", i); - ret = dict_get_int32 (dict, key, &status_rcd); - if (ret) - goto out; ret = xmlTextWriterWriteFormatElement (writer, (xmlChar *)"status", "%d", status_rcd); -- cgit