diff options
author | Susant Palai <spalai@redhat.com> | 2014-02-03 08:50:07 +0000 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2014-02-05 23:38:16 -0800 |
commit | c04c8a4cb1dcf20bdf05e9bdbf26862a1cf50979 (patch) | |
tree | b879517a865142037ed96ef57ffff3ae543538b6 /cli | |
parent | 3bc23e1ad08e212538d325ec0196ec7488ae7e62 (diff) |
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 <spalai@redhat.com>
Reviewed-on: http://review.gluster.org/6889
Reviewed-by: Kaushal M <kaushal@redhat.com>
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'cli')
-rw-r--r-- | cli/src/cli-rpc-ops.c | 18 | ||||
-rw-r--r-- | cli/src/cli-xml-output.c | 35 |
2 files changed, 32 insertions, 21 deletions
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c index 0b6bcb54b81..1da1cb90be7 100644 --- a/cli/src/cli-rpc-ops.c +++ b/cli/src/cli-rpc-ops.c @@ -42,6 +42,11 @@ #include "cli-quotad-client.h" #include "run.h" +enum gf_task_types { + GF_TASK_TYPE_REBALANCE, + GF_TASK_TYPE_REMOVE_BRICK +}; + extern struct rpc_clnt *global_quotad_rpc; extern rpc_clnt_prog_t cli_quotad_clnt; extern rpc_clnt_prog_t *cli_rpc_prog; @@ -1225,7 +1230,7 @@ out: } int -gf_cli_print_rebalance_status (dict_t *dict) +gf_cli_print_rebalance_status (dict_t *dict, enum gf_task_types task_type) { int ret = -1; int count = 0; @@ -1316,6 +1321,13 @@ gf_cli_print_rebalance_status (dict_t *dict) if (ret) gf_log ("cli", GF_LOG_TRACE, "failed to get skipped count"); + + /* For remove-brick include skipped count into failure count*/ + if (task_type != GF_TASK_TYPE_REBALANCE) { + failures += skipped; + skipped = 0; + } + memset (key, 0, 256); snprintf (key, 256, "run-time-%d", i); ret = dict_get_double (dict, key, &elapsed); @@ -1470,7 +1482,7 @@ gf_cli_defrag_volume_cbk (struct rpc_req *req, struct iovec *iov, goto out; } - ret = gf_cli_print_rebalance_status (dict); + ret = gf_cli_print_rebalance_status (dict, GF_TASK_TYPE_REBALANCE); if (ret) gf_log ("cli", GF_LOG_ERROR, "Failed to print rebalance status"); @@ -1873,7 +1885,7 @@ xml_output: goto out; } - ret = gf_cli_print_rebalance_status (dict); + ret = gf_cli_print_rebalance_status (dict, GF_TASK_TYPE_REMOVE_BRICK); if (ret) { gf_log ("cli", GF_LOG_ERROR, "Failed to print remove-brick " "rebalance status"); diff --git a/cli/src/cli-xml-output.c b/cli/src/cli-xml-output.c index 822b98df5d1..ae6b051ed54 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, |