summaryrefslogtreecommitdiffstats
path: root/cli/src
diff options
context:
space:
mode:
authorSamikshan Bairagya <samikshan@gmail.com>2016-12-28 20:33:54 +0530
committerAtin Mukherjee <amukherj@redhat.com>2017-01-12 10:20:59 -0800
commit2e5383266869c13ee27ceaee5b24b686e2415df4 (patch)
tree3603d5288b805ef252edf4d311bb78b9f137e494 /cli/src
parent84271e12efb783bfc83133329b0fd18aba729c84 (diff)
glusterd: Add info on op-version for clients in vol status output
Currently the `gluster volume status <VOLNAME|all> clients` command gives us the following information on clients: 1. Brick name 2. Client count for each brick 3. hostname:port for each client 4. Bytes read and written for each client There is no information regarding op-version for each client. This patch adds that to the output. Change-Id: Ib2ece93ab00c234162bb92b7c67a7d86f3350a8d BUG: 1409078 Signed-off-by: Samikshan Bairagya <samikshan@gmail.com> Reviewed-on: http://review.gluster.org/16303 Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Diffstat (limited to 'cli/src')
-rw-r--r--cli/src/cli-rpc-ops.c19
-rw-r--r--cli/src/cli-xml-output.c12
2 files changed, 25 insertions, 6 deletions
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c
index 97cf7410aea..2ecee81daee 100644
--- a/cli/src/cli-rpc-ops.c
+++ b/cli/src/cli-rpc-ops.c
@@ -7229,6 +7229,7 @@ cli_print_volume_status_clients (dict_t *dict, gf_boolean_t notbrick)
char *clientname = NULL;
uint64_t bytesread = 0;
uint64_t byteswrite = 0;
+ uint32_t opversion = 0;
char key[1024] = {0,};
int i = 0;
int j = 0;
@@ -7294,10 +7295,10 @@ cli_print_volume_status_clients (dict_t *dict, gf_boolean_t notbrick)
if (client_count == 0)
continue;
- cli_out ("%-48s %15s %15s", "Hostname", "BytesRead",
- "BytesWritten");
- cli_out ("%-48s %15s %15s", "--------", "---------",
- "------------");
+ cli_out ("%-48s %15s %15s %15s", "Hostname", "BytesRead",
+ "BytesWritten", "OpVersion");
+ cli_out ("%-48s %15s %15s %15s", "--------", "---------",
+ "------------", "---------");
for (j =0; j < client_count; j++) {
memset (key, 0, sizeof (key));
snprintf (key, sizeof (key),
@@ -7314,8 +7315,14 @@ cli_print_volume_status_clients (dict_t *dict, gf_boolean_t notbrick)
"brick%d.client%d.byteswrite", i, j);
ret = dict_get_uint64 (dict, key, &byteswrite);
- cli_out ("%-48s %15"PRIu64" %15"PRIu64,
- clientname, bytesread, byteswrite);
+ memset (key, 0, sizeof (key));
+ snprintf (key, sizeof (key),
+ "brick%d.client%d.opversion", i, j);
+ ret = dict_get_uint32 (dict, key, &opversion);
+
+ cli_out ("%-48s %15"PRIu64" %15"PRIu64" %15"PRIu32,
+ clientname, bytesread, byteswrite,
+ opversion);
}
}
out:
diff --git a/cli/src/cli-xml-output.c b/cli/src/cli-xml-output.c
index fe03ea17265..3de7d064bec 100644
--- a/cli/src/cli-xml-output.c
+++ b/cli/src/cli-xml-output.c
@@ -743,6 +743,7 @@ cli_xml_output_vol_status_clients (xmlTextWriterPtr writer, dict_t *dict,
char *hostname = NULL;
uint64_t bytes_read = 0;
uint64_t bytes_write = 0;
+ uint32_t opversion = 0;
char key[1024] = {0,};
int i = 0;
@@ -797,6 +798,17 @@ cli_xml_output_vol_status_clients (xmlTextWriterPtr writer, dict_t *dict,
"%"PRIu64, bytes_write);
XML_RET_CHECK_AND_GOTO (ret, out);
+ memset (key, 0, sizeof (key));
+ snprintf (key, sizeof (key), "brick%d.client%d.opversion",
+ brick_index, i);
+ ret = dict_get_uint32 (dict, key, &opversion);
+ if (ret)
+ goto out;
+ ret = xmlTextWriterWriteFormatElement (writer,
+ (xmlChar *)"opVersion",
+ "%"PRIu32, opversion);
+ XML_RET_CHECK_AND_GOTO (ret, out);
+
/* </client> */
ret = xmlTextWriterEndElement (writer);
XML_RET_CHECK_AND_GOTO (ret, out);