summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMilind Changire <mchangir@redhat.com>2016-10-27 22:53:43 +0530
committerAravinda VK <avishwan@redhat.com>2016-11-17 03:30:54 -0800
commit592fd52d5889cf8a46727b3609cdff60e9ef5c00 (patch)
tree1e4951eb19635f897229fe40f76cddadcd75ab4e
parentb7ebffbda9ba784ccfae6d1a90766d5310cdaa15 (diff)
tools/glusterfind: xml parsing fix for tiered volumes
gluster volume info <vol> --xml for non-tiered volumes have 'bricks/brick' elements under the 'volInfo/volumes/volume' element. However, tiered volumes have a 'bricks/hotBricks/brick' and 'bricks/coldBricks/brick' elements under the 'volInfo/volumes/volume' element. Fix main.py::get_nodes() BUG: 1389481 Change-Id: I2f4465bfa8a55e7fa87917d3ec3e69b05d5241b9 Signed-off-by: Milind Changire <mchangir@redhat.com> Reviewed-on: http://review.gluster.org/15746 NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Smoke: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Aravinda VK <avishwan@redhat.com>
-rw-r--r--tools/glusterfind/src/main.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/tools/glusterfind/src/main.py b/tools/glusterfind/src/main.py
index 0c993f50db3..f051314b6dc 100644
--- a/tools/glusterfind/src/main.py
+++ b/tools/glusterfind/src/main.py
@@ -265,13 +265,22 @@ def get_nodes(volume):
# this status is used in caller: run_cmd_nodes
vol_statusStr = tree.find('volInfo/volumes/volume/statusStr').text
+ vol_typeStr = tree.find('volInfo/volumes/volume/typeStr').text
nodes = []
volume_el = tree.find('volInfo/volumes/volume')
try:
- for b in volume_el.findall('bricks/brick'):
- nodes.append((b.find('hostUuid').text,
- b.find('name').text))
+ brick_elems = []
+ if vol_typeStr == "Tier":
+ brick_elems.append('bricks/hotBricks/brick')
+ brick_elems.append('bricks/coldBricks/brick')
+ else:
+ brick_elems.append('bricks/brick')
+
+ for elem in brick_elems:
+ for b in volume_el.findall(elem):
+ nodes.append((b.find('hostUuid').text,
+ b.find('name').text))
except (ParseError, AttributeError, ValueError) as e:
fail("Failed to parse Volume Info: %s" % e, logger=logger)