summaryrefslogtreecommitdiffstats
path: root/cli
diff options
context:
space:
mode:
authorDan Lambright <dlambrig@redhat.com>2015-04-16 05:21:16 +0100
committerKaleb KEITHLEY <kkeithle@redhat.com>2015-05-08 10:38:08 -0700
commit680b3bf629f0fef038470baab62c6d6d8f5988ce (patch)
tree065e73785c42e9da18e2ffe6b85e518219b7a5d2 /cli
parentd4d9cfc82d7cf7797227b8b929ba193fbaf389e6 (diff)
glusterd: add counter support for tiered volumes
This fix adds support to view the number of promoted or demoted files from the cli. The mechanism is isolmorphic to checking the status of volumes being rebalanced. gluster volume rebalance <vol> tier status Change-Id: I1b11ca27355ceec36c488967c23531202030e205 BUG: 1213063 Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com> Signed-off-by: Dan Lambright <dlambrig@redhat.com> Reviewed-on: http://review.gluster.org/10292 Reviewed-by: Atin Mukherjee <amukherj@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'cli')
-rw-r--r--cli/src/cli-rpc-ops.c99
1 files changed, 21 insertions, 78 deletions
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c
index 2b84aa6b060..59f0c6ed9d3 100644
--- a/cli/src/cli-rpc-ops.c
+++ b/cli/src/cli-rpc-ops.c
@@ -1452,15 +1452,11 @@ gf_cli_print_tier_status (dict_t *dict, enum gf_task_types task_type)
int ret = -1;
int count = 0;
int i = 1;
+ uint64_t promoted = 0;
+ uint64_t demoted = 0;
char key[256] = {0,};
- gf_defrag_status_t status_rcd = GF_DEFRAG_STATUS_NOT_STARTED;
- uint64_t files = 0;
- uint64_t size = 0;
- uint64_t lookup = 0;
char *node_name = NULL;
- uint64_t failures = 0;
- uint64_t skipped = 0;
- double elapsed = 0;
+ gf_defrag_status_t status_rcd = GF_DEFRAG_STATUS_NOT_STARTED;
char *status_str = NULL;
char *size_str = NULL;
@@ -1470,105 +1466,52 @@ gf_cli_print_tier_status (dict_t *dict, enum gf_task_types task_type)
goto out;
}
+ cli_out ("%-20s %-20s %-20s %-20s", "Node", "Promoted files",
+ "Demoted files", "Status");
+ cli_out ("%-20s %-20s %-20s %-20s", "---------", "---------",
+ "---------", "---------");
- cli_out ("%40s %16s %13s %13s %13s %13s %20s %18s", "Node",
- "Rebalanced-files", "size", "scanned", "failures", "skipped",
- "status", "run time in secs");
- cli_out ("%40s %16s %13s %13s %13s %13s %20s %18s", "---------",
- "-----------", "-----------", "-----------", "-----------",
- "-----------", "------------", "--------------");
for (i = 1; i <= count; i++) {
/* Reset the variables to prevent carryover of values */
node_name = NULL;
- files = 0;
- size = 0;
- lookup = 0;
- skipped = 0;
- status_str = NULL;
- elapsed = 0;
+ promoted = 0;
+ demoted = 0;
- /* Check if status is NOT_STARTED, and continue early */
memset (key, 0, 256);
- snprintf (key, 256, "status-%d", i);
- ret = dict_get_int32 (dict, key, (int32_t *)&status_rcd);
- if (ret) {
- gf_log ("cli", GF_LOG_TRACE, "failed to get status");
- goto out;
- }
- if (GF_DEFRAG_STATUS_NOT_STARTED == status_rcd)
- continue;
-
-
snprintf (key, 256, "node-name-%d", i);
ret = dict_get_str (dict, key, &node_name);
if (ret)
gf_log ("cli", GF_LOG_TRACE, "failed to get node-name");
memset (key, 0, 256);
- snprintf (key, 256, "files-%d", i);
- ret = dict_get_uint64 (dict, key, &files);
- if (ret)
- gf_log ("cli", GF_LOG_TRACE,
- "failed to get file count");
-
- memset (key, 0, 256);
- snprintf (key, 256, "size-%d", i);
- ret = dict_get_uint64 (dict, key, &size);
- if (ret)
- gf_log ("cli", GF_LOG_TRACE,
- "failed to get size of xfer");
-
- memset (key, 0, 256);
- snprintf (key, 256, "lookups-%d", i);
- ret = dict_get_uint64 (dict, key, &lookup);
+ snprintf (key, 256, "promoted-%d", i);
+ ret = dict_get_uint64 (dict, key, &promoted);
if (ret)
gf_log ("cli", GF_LOG_TRACE,
- "failed to get lookedup file count");
+ "failed to get promoted count");
memset (key, 0, 256);
- snprintf (key, 256, "failures-%d", i);
- ret = dict_get_uint64 (dict, key, &failures);
+ snprintf (key, 256, "demoted-%d", i);
+ ret = dict_get_uint64 (dict, key, &demoted);
if (ret)
gf_log ("cli", GF_LOG_TRACE,
- "failed to get failures count");
+ "failed to get demoted count");
memset (key, 0, 256);
- snprintf (key, 256, "skipped-%d", i);
- ret = dict_get_uint64 (dict, key, &skipped);
+ snprintf (key, 256, "status-%d", i);
+ ret = dict_get_int32 (dict, key, (int32_t *)&status_rcd);
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);
- if (ret)
- gf_log ("cli", GF_LOG_TRACE, "failed to get run-time");
+ "failed to get status");
/* 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);
- 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);
+ cli_out ("%-20s %-20"PRIu64" %-20"PRIu64" %-20s",
+ node_name, promoted, demoted, status_str);
+
}
out:
return ret;