diff options
| author | Krishnan Parthasarathi <kparthas@redhat.com> | 2013-12-23 14:07:40 +0530 | 
|---|---|---|
| committer | Vijay Bellur <vbellur@redhat.com> | 2013-12-23 06:56:17 -0800 | 
| commit | 3ef4b7eb9d1f4e305e1b7c85ee5bb51d7b18e305 (patch) | |
| tree | e7fb00cd96683472e414989fd989c199bc34558b | |
| parent | 7683a4bed9d3168f9a6e70af1a7e316334b201cb (diff) | |
cli: More checks in rebalance status output
Change-Id: Ibd2edc5608ae6d3370607bff1c626c8347c4deda
BUG: 1031887
Signed-off-by: Krishnan Parthasarathi <kparthas@redhat.com>
Reviewed-on: http://review.gluster.org/6561
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
| -rw-r--r-- | cli/src/cli-rpc-ops.c | 20 | ||||
| -rw-r--r-- | rpc/xdr/src/cli1-xdr.h | 1 | ||||
| -rw-r--r-- | rpc/xdr/src/cli1-xdr.x | 3 | 
3 files changed, 19 insertions, 5 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: diff --git a/rpc/xdr/src/cli1-xdr.h b/rpc/xdr/src/cli1-xdr.h index 0bed637e283..e1cb34dc96f 100644 --- a/rpc/xdr/src/cli1-xdr.h +++ b/rpc/xdr/src/cli1-xdr.h @@ -52,6 +52,7 @@ enum gf_defrag_status_t {  	GF_DEFRAG_STATUS_LAYOUT_FIX_STOPPED = 6,  	GF_DEFRAG_STATUS_LAYOUT_FIX_COMPLETE = 7,  	GF_DEFRAG_STATUS_LAYOUT_FIX_FAILED = 8, +	GF_DEFRAG_STATUS_MAX = 9,  };  typedef enum gf_defrag_status_t gf_defrag_status_t; diff --git a/rpc/xdr/src/cli1-xdr.x b/rpc/xdr/src/cli1-xdr.x index 07327c72729..46f4581eeae 100644 --- a/rpc/xdr/src/cli1-xdr.x +++ b/rpc/xdr/src/cli1-xdr.x @@ -15,7 +15,8 @@          GF_DEFRAG_STATUS_LAYOUT_FIX_STARTED,          GF_DEFRAG_STATUS_LAYOUT_FIX_STOPPED,          GF_DEFRAG_STATUS_LAYOUT_FIX_COMPLETE, -        GF_DEFRAG_STATUS_LAYOUT_FIX_FAILED +        GF_DEFRAG_STATUS_LAYOUT_FIX_FAILED, +        GF_DEFRAG_STATUS_MAX  } ;   enum gf1_cluster_type {  | 
