summaryrefslogtreecommitdiffstats
path: root/cli
diff options
context:
space:
mode:
authorshishir gowda <shishirng@gluster.com>2012-05-08 16:21:29 +0530
committerAnand Avati <avati@redhat.com>2012-05-24 00:03:36 -0700
commit9f81eb0b24f27ea9797bb8a4ff062e6f77e872fd (patch)
tree06c78440191efc51fa836872d98f8529d428c0ba /cli
parenteff9a75fd95d98b30d0aaa04903ab42b56951d34 (diff)
glusterd/rebalance: Display run-time of rebalance process
Added run-time value field to cli output of rebalance/remove-brick. A new cluster/distribute boolean option rebalance-stats when set to ON, time taken for migration of each file is logged. With rebalance-stats OFF (default), rebalance logs will only have entries showing time spent in each directory. Change-Id: I02a8918621120068cd71ffaf2999d30b3a2d10a2 BUG: 821987 Signed-off-by: shishir gowda <shishirng@gluster.com> Reviewed-on: http://review.gluster.com/3303 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.c42
1 files changed, 30 insertions, 12 deletions
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c
index 9737e13f9..2ab13261a 100644
--- a/cli/src/cli-rpc-ops.c
+++ b/cli/src/cli-rpc-ops.c
@@ -1040,6 +1040,7 @@ gf_cli3_1_defrag_volume_cbk (struct rpc_req *req, struct iovec *iov,
char key[256] = {0,};
int32_t i = 1;
uint64_t failures = 0;
+ double elapsed = 0;
if (-1 == req->rpc_status) {
goto out;
@@ -1138,10 +1139,11 @@ gf_cli3_1_defrag_volume_cbk (struct rpc_req *req, struct iovec *iov,
goto done;
}
}
- cli_out ("%40s %16s %13s %13s %13s %14s", "Node", "Rebalanced-files",
- "size", "scanned", "failures","status");
- cli_out ("%40s %16s %13s %13s %13s %14s", "---------", "-----------",
- "-----------", "-----------", "-----------", "------------");
+ cli_out ("%40s %16s %13s %13s %13s %14s %s", "Node", "Rebalanced-files",
+ "size", "scanned", "failures", "status", "run time in secs");
+ cli_out ("%40s %16s %13s %13s %13s %14s %14s", "---------",
+ "-----------", "-----------", "-----------", "-----------",
+ "------------", "-----------");
do {
snprintf (key, 256, "node-uuid-%d", i);
@@ -1185,6 +1187,13 @@ gf_cli3_1_defrag_volume_cbk (struct rpc_req *req, struct iovec *iov,
gf_log (THIS->name, GF_LOG_TRACE,
"failed to get failures count");
+ memset (key, 0, 256);
+ snprintf (key, 256, "run-time-%d", i);
+ ret = dict_get_double (dict, key, &elapsed);
+ if (ret)
+ gf_log (THIS->name, GF_LOG_TRACE,
+ "failed to get run-time");
+
switch (status_rcd) {
case GF_DEFRAG_STATUS_NOT_STARTED:
status = "not started";
@@ -1203,8 +1212,8 @@ gf_cli3_1_defrag_volume_cbk (struct rpc_req *req, struct iovec *iov,
break;
}
cli_out ("%40s %16"PRId64 "%13"PRId64 "%13"PRId64 "%13"PRId64
- " %14s", node_uuid, files, size, lookup, failures,
- status);
+ " %14s %14.2f", node_uuid, files, size, lookup,
+ failures, status, elapsed);
i++;
} while (i <= counter);
@@ -1469,6 +1478,7 @@ gf_cli3_remove_brick_status_cbk (struct rpc_req *req, struct iovec *iov,
char *node_uuid = 0;
gf_defrag_status_t status_rcd = GF_DEFRAG_STATUS_NOT_STARTED;
uint64_t failures = 0;
+ double elapsed = 0;
if (-1 == req->rpc_status) {
@@ -1514,10 +1524,11 @@ gf_cli3_remove_brick_status_cbk (struct rpc_req *req, struct iovec *iov,
}
- cli_out ("%40s %16s %13s %13s %13s %14s", "Node", "Rebalanced-files",
- "size", "scanned", "failures", "status");
- cli_out ("%40s %16s %13s %13s %13s %14s", "---------", "-----------",
- "-----------", "-----------", "-----------", "------------");
+ cli_out ("%40s %16s %13s %13s %13s %14s %s", "Node", "Rebalanced-files",
+ "size", "scanned", "failures", "status", "run-time in secs");
+ cli_out ("%40s %16s %13s %13s %13s %14s %14s", "---------",
+ "-----------", "-----------", "-----------", "-----------",
+ "------------", "------------");
do {
snprintf (key, 256, "node-uuid-%d", i);
@@ -1560,6 +1571,13 @@ gf_cli3_remove_brick_status_cbk (struct rpc_req *req, struct iovec *iov,
gf_log (THIS->name, GF_LOG_TRACE,
"Failed to get failure on files");
+ memset (key, 0, 256);
+ snprintf (key, 256, "run-time-%d", i);
+ ret = dict_get_double (dict, key, &elapsed);
+ if (ret)
+ gf_log (THIS->name, GF_LOG_TRACE,
+ "Failed to get run-time");
+
switch (status_rcd) {
case GF_DEFRAG_STATUS_NOT_STARTED:
status = "not started";
@@ -1578,8 +1596,8 @@ gf_cli3_remove_brick_status_cbk (struct rpc_req *req, struct iovec *iov,
break;
}
cli_out ("%40s %16"PRId64 "%13"PRId64 "%13"PRId64 "%13"PRId64
- " %14s", node_uuid, files, size, lookup, failures,
- status);
+ " %14s %14.2f", node_uuid, files, size, lookup,
+ failures, status, elapsed);
i++;
} while (i <= counter);