From b0e126d0edf10946701c2fd4f0f1cf8c7b07eda1 Mon Sep 17 00:00:00 2001 From: Gaurav Kumar Garg Date: Wed, 16 Dec 2015 18:04:55 +0530 Subject: 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 Reviewed-on: http://review.gluster.org/12982 Tested-by: NetBSD Build System Reviewed-by: mohammed rafi kc Tested-by: Gluster Build System Reviewed-by: Kotresh HR Reviewed-by: Atin Mukherjee --- cli/src/cli-xml-output.c | 47 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 32 insertions(+), 15 deletions(-) (limited to 'cli/src') 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 -- cgit