summaryrefslogtreecommitdiffstats
path: root/cli/src
diff options
context:
space:
mode:
authorBala.FA <barumuga@redhat.com>2013-09-26 08:09:35 +0530
committerAnand Avati <avati@redhat.com>2013-10-03 22:25:59 -0700
commitd9db4a8ff300012eee87f31d73e303862d2de9b6 (patch)
tree88e1c43c283366d8dd9c9c4a8e13218c7890e80c /cli/src
parentdcfe4ab475c53cec7d117fb8052b26213a4b41db (diff)
cli: add node uuid in rebalance and remove brick status xml output
This patch adds node uuid in rebalance/remove-brick status xml output. Output XML will look like <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <cliOutput> <opRet>0</opRet> <opErrno>0</opErrno> <opErrstr/> <volRebalance> <op>3</op> <nodeCount>1</nodeCount> <node> <nodeName>localhost</nodeName> ==>> <id>883626f8-4d29-4d02-8c5d-c9f48c5b2445</id> <files>0</files> <size>0</size> <lookups>0</lookups> <failures>0</failures> <status>3</status> <statusStr>completed</statusStr> </node> <aggregate> <files>0</files> <size>0</size> <lookups>0</lookups> <failures>0</failures> <status>3</status> <statusStr>completed</statusStr> </aggregate> </volRebalance> </cliOutput> Change-Id: I5a1d4f9043b33b9e88150647a243ddb16154e843 BUG: 1012296 Signed-off-by: Bala.FA <barumuga@redhat.com> Reviewed-on: http://review.gluster.org/6005 Reviewed-by: Kaushal M <kaushal@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'cli/src')
-rw-r--r--cli/src/cli-rpc-ops.c20
-rw-r--r--cli/src/cli-xml-output.c12
2 files changed, 21 insertions, 11 deletions
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c
index fe3db41b6bf..f9605c10492 100644
--- a/cli/src/cli-rpc-ops.c
+++ b/cli/src/cli-rpc-ops.c
@@ -1213,7 +1213,7 @@ gf_cli_defrag_volume_cbk (struct rpc_req *req, struct iovec *iov,
char msg[1024] = {0,};
gf_defrag_status_t status_rcd = GF_DEFRAG_STATUS_NOT_STARTED;
int32_t counter = 0;
- char *node_uuid = NULL;
+ char *node_name = NULL;
char key[256] = {0,};
int32_t i = 1;
uint64_t failures = 0;
@@ -1345,11 +1345,11 @@ gf_cli_defrag_volume_cbk (struct rpc_req *req, struct iovec *iov,
"-----------", "-----------", "-----------", "-----------",
"-----------", "------------", "--------------");
do {
- snprintf (key, 256, "node-uuid-%d", i);
- ret = dict_get_str (dict, key, &node_uuid);
+ snprintf (key, 256, "node-name-%d", i);
+ ret = dict_get_str (dict, key, &node_name);
if (ret)
gf_log (frame->this->name, GF_LOG_TRACE,
- "failed to get node-uuid");
+ "failed to get node-name");
memset (key, 0, 256);
snprintf (key, 256, "files-%d", i);
@@ -1402,7 +1402,7 @@ gf_cli_defrag_volume_cbk (struct rpc_req *req, struct iovec *iov,
status = 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_uuid, files,
+ " %13"PRIu64 " %20s %18.2f", node_name, files,
size_str, lookup, failures, skipped, status, elapsed);
GF_FREE(size_str);
@@ -1716,7 +1716,7 @@ gf_cli3_remove_brick_status_cbk (struct rpc_req *req, struct iovec *iov,
char key[256] = {0,};
int32_t i = 1;
int32_t counter = 0;
- char *node_uuid = 0;
+ char *node_name = 0;
gf_defrag_status_t status_rcd = GF_DEFRAG_STATUS_NOT_STARTED;
uint64_t failures = 0;
uint64_t skipped = 0;
@@ -1828,11 +1828,11 @@ xml_output:
"-----------","------------", "--------------");
do {
- snprintf (key, 256, "node-uuid-%d", i);
- ret = dict_get_str (dict, key, &node_uuid);
+ snprintf (key, 256, "node-name-%d", i);
+ ret = dict_get_str (dict, key, &node_name);
if (ret)
gf_log (frame->this->name, GF_LOG_TRACE,
- "failed to get node-uuid");
+ "failed to get node-name");
memset (key, 0, 256);
snprintf (key, 256, "files-%d", i);
@@ -1904,7 +1904,7 @@ xml_output:
if (strcmp (status, "not started")) {
cli_out ("%40s %16"PRIu64 " %13s" " %13"PRIu64 " %13"
- PRIu64 " %13"PRIu64 " %14s %16.2f", node_uuid,
+ PRIu64 " %13"PRIu64 " %14s %16.2f", node_name,
files, size_str, lookup, failures, skipped,
status, elapsed);
}
diff --git a/cli/src/cli-xml-output.c b/cli/src/cli-xml-output.c
index cb42e303dac..6cc734a18ea 100644
--- a/cli/src/cli-xml-output.c
+++ b/cli/src/cli-xml-output.c
@@ -2989,6 +2989,7 @@ cli_xml_output_vol_rebalance_status (xmlTextWriterPtr writer, dict_t *dict,
int ret = -1;
int count = 0;
char *node_name = NULL;
+ char *node_uuid = NULL;
uint64_t files = 0;
uint64_t size = 0;
uint64_t lookups = 0;
@@ -3026,13 +3027,22 @@ cli_xml_output_vol_rebalance_status (xmlTextWriterPtr writer, dict_t *dict,
XML_RET_CHECK_AND_GOTO (ret, out);
memset (key, 0, sizeof (key));
- snprintf (key, sizeof (key), "node-uuid-%d", i);
+ snprintf (key, sizeof (key), "node-name-%d", i);
ret = dict_get_str (dict, key, &node_name);
if (ret)
goto out;
ret = xmlTextWriterWriteFormatElement (writer,
(xmlChar *)"nodeName",
"%s", node_name);
+
+ memset (key, 0, sizeof (key));
+ snprintf (key, sizeof (key), "node-uuid-%d", i);
+ ret = dict_get_str (dict, key, &node_uuid);
+ if (ret)
+ goto out;
+ ret = xmlTextWriterWriteFormatElement (writer,
+ (xmlChar *)"id",
+ "%s", node_uuid);
XML_RET_CHECK_AND_GOTO (ret, out);
memset (key, 0, sizeof (key));