diff options
| author | hari gowtham <hgowtham@redhat.com> | 2015-09-15 11:07:03 +0530 | 
|---|---|---|
| committer | Dan Lambright <dlambrig@redhat.com> | 2015-09-22 08:11:56 -0700 | 
| commit | c94f5bdf309f024c30cc4796b528edb1e1b4a48b (patch) | |
| tree | 9f2149dbbf0df668ce7bbf684ba0d1d90bb20081 /cli/src | |
| parent | 5d7dbda72bd35f1b8f52543503318eb049bfe0e7 (diff) | |
Tier/cli: tier related information in volume status command
        back port of : http://review.gluster.org/#/c/12176/
<?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>
Change-Id: Idfdbce47d03ee2cdbf407c57159fd37a2900ad2c
BUG: 1258347 
Signed-off-by: Hari Gowtham <hgowtham@redhat.com>
Reviewed-on: http://review.gluster.org/12200
Tested-by: Gluster Build System <jenkins@build.gluster.com>
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')
| -rw-r--r-- | cli/src/cli-xml-output.c | 34 | 
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           */  | 
