summaryrefslogtreecommitdiffstats
path: root/cli/src/cli-xml-output.c
diff options
context:
space:
mode:
authorhari gowtham <hgowtham@redhat.com>2015-09-15 11:07:03 +0530
committerDan Lambright <dlambrig@redhat.com>2015-09-18 06:44:54 -0700
commitcb8db8dfce0394e30cb25983a402de7beaa9c63f (patch)
tree5905a19232f2ab58fcd681bb713e01456926abe3 /cli/src/cli-xml-output.c
parentbb2370514598a99e6ab268af81df57dc16caa2c5 (diff)
Tier/cli: tier related information in volume status command
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <cliOutput> <opRet>0</opRet> <opErrno>0</opErrno> <opErrstr/> <volStatus> <volumes> <volume> <volName>v1</volName> <nodeCount>5</nodeCount> <hotBrick> <node> <hostname>10.70.42.203</hostname> <path>/data/gluster/tier/hbr1</path> <peerid>137e2a4f-2bde-4a97-b3f3-470a2e092155</peerid> <status>1</status> <port>49154</port> <ports> <tcp>49154</tcp> <rdma>N/A</rdma> </ports> <pid>6535</pid> </node> </hotBrick> <coldBrick> <node> <hostname>10.70.42.203</hostname> <path>/data/gluster/tier/cb1</path> <peerid>137e2a4f-2bde-4a97-b3f3-470a2e092155</peerid> <status>1</status> <port>49152</port> <ports> <tcp>49152</tcp> <rdma>N/A</rdma> </ports> <pid>6530</pid> </node> </coldBrick> <coldBrick> <node> <hostname>NFS Server</hostname> <path>10.70.42.203</path> <peerid>137e2a4f-2bde-4a97-b3f3-470a2e092155</peerid> <status>1</status> <port>2049</port> <ports> <tcp>2049</tcp> <rdma>N/A</rdma> </ports> <pid>6519</pid> </node> </coldBrick> <tasks> <task> <type>Rebalance</type> <id>8da729f2-f1b2-4f55-9945-472130be93f7</id> <status>4</status> <statusStr>failed</statusStr> </task> </tasks> </volume> <tasks/> </volume> </volumes> </volStatus> </cliOutput> Change-Id: Idfdbce47d03ee2cdbf407c57159fd37a2900ad2c BUG: 1263100 Signed-off-by: hari gowtham <hgowtham@redhat.com> Reviewed-on: http://review.gluster.org/12176 Tested-by: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Dan Lambright <dlambrig@redhat.com> Tested-by: Dan Lambright <dlambrig@redhat.com>
Diffstat (limited to 'cli/src/cli-xml-output.c')
-rw-r--r--cli/src/cli-xml-output.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/cli/src/cli-xml-output.c b/cli/src/cli-xml-output.c
index 327cd6c6ffd..3ad7250397b 100644
--- a/cli/src/cli-xml-output.c
+++ b/cli/src/cli-xml-output.c
@@ -1620,7 +1620,8 @@ cli_xml_output_vol_status (cli_local_t *local, dict_t *dict)
int online = 0;
gf_boolean_t node_present = _gf_true;
int i;
-
+ int type = -1;
+ int hot_brick_count = -1;
/* <volume> */
ret = xmlTextWriterStartElement (local->writer, (xmlChar *)"volume");
@@ -1656,7 +1657,28 @@ cli_xml_output_vol_status (cli_local_t *local, dict_t *dict)
index_max = brick_index_max + other_count;
+ ret = dict_get_int32 (dict, "type", &type);
+ if (ret)
+ goto out;
+
+ if (type == GF_CLUSTER_TYPE_TIER) {
+ ret = dict_get_int32 (dict, "hot_brick_count",
+ &hot_brick_count);
+ if (ret)
+ goto out;
+
+ ret = xmlTextWriterStartElement
+ (local->writer, (xmlChar *)"hotBrick");
+ XML_RET_CHECK_AND_GOTO (ret, out);
+
+ }
for (i = 0; i <= index_max; i++) {
+
+ if (type == GF_CLUSTER_TYPE_TIER && i >= hot_brick_count) {
+ ret = xmlTextWriterStartElement (local->writer,
+ (xmlChar *)"coldBrick");
+ XML_RET_CHECK_AND_GOTO (ret, out);
+ }
ret = cli_xml_output_vol_status_common (local->writer, dict, i,
&online, &node_present);
if (ret) {
@@ -1726,8 +1748,18 @@ cli_xml_output_vol_status (cli_local_t *local, dict_t *dict)
/* </node> was opened in cli_xml_output_vol_status_common()*/
ret = xmlTextWriterEndElement (local->writer);
XML_RET_CHECK_AND_GOTO (ret, out);
+
+ if (type == GF_CLUSTER_TYPE_TIER && i < hot_brick_count) {
+ ret = xmlTextWriterEndElement (local->writer);
+ XML_RET_CHECK_AND_GOTO (ret, out);
+ }
+ if (type == GF_CLUSTER_TYPE_TIER && i >= hot_brick_count) {
+ ret = xmlTextWriterEndElement (local->writer);
+ XML_RET_CHECK_AND_GOTO (ret, out);
+ }
}
+
/* Tasks are only present when a normal volume status call is done on a
* single volume or on all volumes
*/