Aled Sage created JCLOUDS-1417: ---------------------------------- Summary: EC2 describeVolumes wrong when tags present Key: JCLOUDS-1417 URL: https://issues.apache.org/jira/browse/JCLOUDS-1417 Project: jclouds Issue Type: Bug Components: jclouds-compute Affects Versions: 2.1.0 Reporter: Aled Sage
When calling \{{elasticBlockStoreApi.describeVolumesInRegion(region, volumeId)}}, it fails to parse the response correctly if the volume has tags. For example, when it gets the XML response below: {noformat} <?xml version="1.0" encoding="UTF-8"?> <DescribeVolumesResponse xmlns="http://ec2.amazonaws.com/doc/2012-06-01/"> <requestId>95d47b6d-5f7a-44a2-922d-03be76b73c0a</requestId> <volumeSet> <item> <volumeId>vol-01234567890123456</volumeId> <size>1</size> <snapshotId/> <availabilityZone>eu-west-1a</availabilityZone> <status>available</status> <createTime>2018-05-14T08:52:45.448Z</createTime> <attachmentSet/> <tagSet> <item> <key>mykey</key> <value>myval</value> </item> </tagSet> <volumeType>gp2</volumeType> <iops>100</iops> </item> </volumeSet> </DescribeVolumesResponse> {noformat} It returns: {noformat} [ Volume [attachments=[], availabilityZone=eu-west-1a, createTime=Mon May 14 09:52:45 BST 2018, id=vol-01234567890123456, region=us-east-1, size=1, snapshotId=null, status=available, volumeType=null, iops=null, encrypted=false], Volume [attachments=[], availabilityZone=null, createTime=null, id=null, region=us-east-1, size=0, snapshotId=null, status=null, volumeType=gp2, iops=100, encrypted=false]] ] {noformat} This is presumably because \{{DescribeVolumesResponseHandler.endElement}} looks to see if it was the "item" element, and if so adds that volume. This causes it to record the half-parsed volume when it comes across the tag's item, and then to treat the rest of the volume's definition as a second volume. You can easily see this by adding tags to {{apis/ec2/src/test/resources/describe_volumes.xml}}, and looking at the results of {{DescribeVolumesResponseHandlerTest}}. -- This message was sent by Atlassian JIRA (v7.6.3#76005)