Uploaded image for project: 'jclouds'
  1. jclouds
  2. JCLOUDS-1417

EC2 describeVolumes wrong when tags present

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.1.0
    • Fix Version/s: None
    • Component/s: jclouds-compute
    • Labels:
      None

      Description

      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:

      <?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>
      

      It returns:

      [
       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]]
      ]
      

      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.

       

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              aled.sage Aled Sage
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: