diff options
author | Gaurav Kumar Garg <garg.gaurav52@gmail.com> | 2015-12-16 18:04:55 +0530 |
---|---|---|
committer | Atin Mukherjee <amukherj@redhat.com> | 2015-12-21 03:46:02 -0800 |
commit | b0e126d0edf10946701c2fd4f0f1cf8c7b07eda1 (patch) | |
tree | 161de0abe16867a3e420cd56d4c73e06651d76f4 | |
parent | d677e195cb85bef28fcd9e2f45e487c9ea792311 (diff) |
cli/xml: display correct xml output of tier volume
Currently When hot tier type is distributed-replicate and cold tier
type is disperse volume then #gluster volume info --xml command is
not giving its correct output. In case of HOT tier case its displaying
wrong volume type.
With this fix it will show correct xml output for tier volume
irrespective of all the type of the volume's.
Change-Id: If1de8d52d1e0ef3d0523163abed37b2b571715e8
BUG: 1292084
Signed-off-by: Gaurav Kumar Garg <ggarg@redhat.com>
Reviewed-on: http://review.gluster.org/12982
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Reviewed-by: mohammed rafi kc <rkavunga@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Kotresh HR <khiremat@redhat.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
-rw-r--r-- | cli/src/cli-xml-output.c | 47 |
1 files changed, 32 insertions, 15 deletions
diff --git a/cli/src/cli-xml-output.c b/cli/src/cli-xml-output.c index 0801d61eeea..7140f803071 100644 --- a/cli/src/cli-xml-output.c +++ b/cli/src/cli-xml-output.c @@ -2799,7 +2799,7 @@ cli_xml_output_vol_info (cli_local_t *local, dict_t *dict) value[HOT_REPLICA_COUNT] : 1); if ((value[HOT_TYPE] != GF_CLUSTER_TYPE_TIER) && (value[HOT_TYPE] > 0) && - (value[hot_dist_count] < value[HOT_BRICK_COUNT])) + (hot_dist_count < value[HOT_BRICK_COUNT])) tier_vol_type = value[HOT_TYPE] + GF_CLUSTER_TYPE_MAX - 1; @@ -2812,6 +2812,18 @@ cli_xml_output_vol_info (cli_local_t *local, dict_t *dict) (local->writer, (xmlChar *)"hotBrickType", "%s", cli_vol_type_str[tier_vol_type]); + ret = xmlTextWriterWriteFormatElement (local->writer, + (xmlChar *)"hotreplicaCount", + "%d", + value[HOT_REPLICA_COUNT]); + XML_RET_CHECK_AND_GOTO (ret, out); + + ret = xmlTextWriterWriteFormatElement (local->writer, + (xmlChar *)"hotbrickCount", + "%d", + value[HOT_BRICK_COUNT]); + XML_RET_CHECK_AND_GOTO (ret, out); + if (value[HOT_TYPE] == GF_CLUSTER_TYPE_NONE || value[HOT_TYPE] == GF_CLUSTER_TYPE_TIER) { @@ -2820,26 +2832,14 @@ cli_xml_output_vol_info (cli_local_t *local, dict_t *dict) (xmlChar *)"numberOfBricks", "%d", value[HOT_BRICK_COUNT]); XML_RET_CHECK_AND_GOTO (ret, out); - } else if (value[HOT_TYPE] == - GF_CLUSTER_TYPE_DISPERSE) { - ret = xmlTextWriterWriteFormatElement - (local->writer, - (xmlChar *)"numberOfBricks", - "%d x (%d + %d) = %d", - (value[HOT_BRICK_COUNT] / - value[hot_dist_count]), - hot_disperse_count - - hot_redundancy_count, - hot_redundancy_count, - value[HOT_BRICK_COUNT]); } else { ret = xmlTextWriterWriteFormatElement (local->writer, (xmlChar *)"numberOfBricks", "%d x %d = %d", (value[HOT_BRICK_COUNT] / - value[hot_dist_count]), - value[hot_dist_count], + hot_dist_count), + hot_dist_count, value[HOT_BRICK_COUNT]); } @@ -2904,6 +2904,22 @@ cli_xml_output_vol_info (cli_local_t *local, dict_t *dict) (local->writer, (xmlChar *)"coldBrickType", "%s", cli_vol_type_str[tier_vol_type]); + ret = xmlTextWriterWriteFormatElement (local->writer, + (xmlChar *)"coldreplicaCount", + "%d", value[COLD_REPLICA_COUNT]); + XML_RET_CHECK_AND_GOTO (ret, out); + + ret = xmlTextWriterWriteFormatElement (local->writer, + (xmlChar *)"coldbrickCount", + "%d", + value[COLD_BRICK_COUNT]); + XML_RET_CHECK_AND_GOTO (ret, out); + + ret = xmlTextWriterWriteFormatElement (local->writer, + (xmlChar *)"colddisperseCount", + "%d", value[COLD_DISPERSE_COUNT]); + XML_RET_CHECK_AND_GOTO (ret, out); + if (value[COLD_TYPE] == GF_CLUSTER_TYPE_NONE || value[COLD_TYPE] == GF_CLUSTER_TYPE_TIER) { @@ -2912,6 +2928,7 @@ cli_xml_output_vol_info (cli_local_t *local, dict_t *dict) (xmlChar *)"numberOfBricks", "%d", value[COLD_BRICK_COUNT]); XML_RET_CHECK_AND_GOTO (ret, out); + } else if (value[COLD_TYPE] == GF_CLUSTER_TYPE_DISPERSE) { ret = xmlTextWriterWriteFormatElement |