summaryrefslogtreecommitdiffstats
path: root/cli/src/cli-xml-output.c
diff options
context:
space:
mode:
authorKaushal M <kaushal@redhat.com>2013-11-12 15:08:26 +0530
committerAnand Avati <avati@redhat.com>2013-11-20 11:30:25 -0800
commitbc9f0bb5ce108cba7e88be123681e2c269da31b7 (patch)
treeef81d3e4a566899ab01cf87b8bdab3d9e8339533 /cli/src/cli-xml-output.c
parente0dbbe851baf564037edc3b967563730a0ed9c81 (diff)
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 <kaushal@redhat.com> Reviewed-on: http://review.gluster.org/6300 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Krutika Dhananjay <kdhananj@redhat.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'cli/src/cli-xml-output.c')
-rw-r--r--cli/src/cli-xml-output.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/cli/src/cli-xml-output.c b/cli/src/cli-xml-output.c
index 0dc0b8ab42a..6c7bc175237 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;
/* <node> */
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);