summaryrefslogtreecommitdiffstats
path: root/cli
diff options
context:
space:
mode:
authorKaushal M <kaushal@redhat.com>2013-11-22 13:03:57 +0530
committerAnand Avati <avati@redhat.com>2013-12-03 15:19:25 -0800
commit916785766777ea74c30df17b6e2c572bc1c9a534 (patch)
treeb6460e4ecb8db4f2b8251e291afa20ef101bb8b5 /cli
parent8a0f744c461166be483f28fe9da37732586585d8 (diff)
cli: More checks in rebalance status output
Change-Id: Ibd2edc5608ae6d3370607bff1c626c8347c4deda BUG: 1031887 Signed-off-by: Kaushal M <kaushal@redhat.com> Reviewed-on: http://review.gluster.org/6337 Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'cli')
-rw-r--r--cli/src/cli-rpc-ops.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c
index d125a928469..3d2f90c0436 100644
--- a/cli/src/cli-rpc-ops.c
+++ b/cli/src/cli-rpc-ops.c
@@ -71,6 +71,7 @@ char *cli_vol_task_status_str[] = {"not started",
"fix-layout stopped",
"fix-layout completed",
"fix-layout failed",
+ "unknown"
};
int32_t
@@ -1321,12 +1322,23 @@ gf_cli_print_rebalance_status (dict_t *dict)
if (ret)
gf_log ("cli", GF_LOG_TRACE, "failed to get run-time");
+ /* Check for array bound */
+ if (status_rcd >= GF_DEFRAG_STATUS_MAX)
+ status_rcd = GF_DEFRAG_STATUS_MAX;
+
status_str = cli_vol_task_status_str[status_rcd];
size_str = gf_uint64_2human_readable(size);
- cli_out ("%40s %16"PRIu64 " %13s" " %13"PRIu64 " %13"PRIu64
- " %13"PRIu64 " %20s %18.2f", node_name, files,
- size_str, lookup, failures, skipped, status_str,
- elapsed);
+ if (size_str) {
+ cli_out ("%40s %16"PRIu64 " %13s" " %13"PRIu64 " %13"
+ PRIu64" %13"PRIu64 " %20s %18.2f", node_name,
+ files, size_str, lookup, failures, skipped,
+ status_str, elapsed);
+ } else {
+ cli_out ("%40s %16"PRIu64 " %13"PRIu64 " %13"PRIu64
+ " %13"PRIu64" %13"PRIu64 " %20s %18.2f",
+ node_name, files, size, lookup, failures,
+ skipped, status_str, elapsed);
+ }
GF_FREE(size_str);
}
out: