From c04c8a4cb1dcf20bdf05e9bdbf26862a1cf50979 Mon Sep 17 00:00:00 2001 From: Susant Palai Date: Mon, 3 Feb 2014 08:50:07 +0000 Subject: cli/cli-xml : skipped files should be treated as failures for remove-brick operation. Fix: For remove-brick operation skipped count is included into failure count. clixml-output : skipped count would be zero always for remove-brick status. Change-Id: Ic0bb23b89e0cf5b884b6d1ae42bbf98deedc9173 BUG: 1060209 Signed-off-by: Susant Palai Reviewed-on: http://review.gluster.org/6889 Reviewed-by: Kaushal M Reviewed-by: Krishnan Parthasarathi Reviewed-by: Vijay Bellur Tested-by: Gluster Build System --- cli/src/cli-xml-output.c | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 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 822b98df5..ae6b051ed 100644 --- a/cli/src/cli-xml-output.c +++ b/cli/src/cli-xml-output.c @@ -3228,31 +3228,30 @@ cli_xml_output_vol_rebalance_status (xmlTextWriterPtr writer, dict_t *dict, ret = dict_get_uint64 (dict, key, &failures); if (ret) goto out; - total_failures += failures; - ret = xmlTextWriterWriteFormatElement (writer, - (xmlChar *)"failures", - "%"PRIu64, failures); - XML_RET_CHECK_AND_GOTO (ret, out); - /* skipped-%d is not available for remove brick in dict, - so using failures as skipped count in case of remove-brick - similar to logic used in CLI(non xml output) */ - if (task_type == GF_TASK_TYPE_REBALANCE) { - memset (key, 0, sizeof (key)); - snprintf (key, sizeof (key), "skipped-%d", i); - } - else { - memset (key, 0, sizeof (key)); - snprintf (key, sizeof (key), "failures-%d", i); - } + memset (key, 0, sizeof (key)); + snprintf (key, sizeof (key), "skipped-%d", i); ret = dict_get_uint64 (dict, key, &skipped); if (ret) goto out; + + if (task_type == GF_TASK_TYPE_REMOVE_BRICK) { + failures += skipped; + skipped = 0; + } + + total_failures += failures; + ret = xmlTextWriterWriteFormatElement (writer, + (xmlChar *)"failures", + "%"PRIu64, failures); + XML_RET_CHECK_AND_GOTO (ret, out); + total_skipped += skipped; + ret = xmlTextWriterWriteFormatElement (writer, - (xmlChar *)"skipped", - "%"PRIu64, skipped); + (xmlChar *)"skipped", + "%"PRIu64, skipped); XML_RET_CHECK_AND_GOTO (ret, out); ret = xmlTextWriterWriteFormatElement (writer, -- cgit