summaryrefslogtreecommitdiffstats
path: root/cli/src/cli-rpc-ops.c
diff options
context:
space:
mode:
Diffstat (limited to 'cli/src/cli-rpc-ops.c')
-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 9737e13f929..2ab13261a9f 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);