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>
This commit is contained in:
hari gowtham 2015-09-15 11:07:03 +05:30 committed by Dan Lambright
parent bb23705145
commit cb8db8dfce

View File

@ -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
*/