Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

blockdevicemapping parsing bug in startElement. #3235

Open
tosildaon opened this issue Jun 18, 2015 · 0 comments
Open

blockdevicemapping parsing bug in startElement. #3235

tosildaon opened this issue Jun 18, 2015 · 0 comments

Comments

@tosildaon
Copy link

In boto 2.38.0, I think there is a bug on startElement of blockdevicemapping.

I am trying to get existing launch configuration and create new launch configuration using it.
Here is a part of my code.

>>> conn = autoscale.connect_to_region(use_block_device_types=True)
>>> asg = conn.get_all_groups(names=["test-asg"])[0]
>>> lc = conn.get_all_launch_configurations(names=[asg.launch_config_name])[0]
>>> print lc.block_device_mappings
{u'/dev/sdd': <boto.ec2.blockdevicemapping.BlockDeviceType object at 0x20f9850>, u'/dev/sde': None, u'/dev/sdb': <boto.ec2.blockdevicemapping.BlockDeviceType object at 0x20f9850>, u'/dev/sdc': None, u'/dev/sda1': <boto.ec2.blockdevicemapping.BlockDeviceType object at 0x20f9850>}

There are three duplicated block device object mapped to different block device name. That is the bug.
Here is returned https response from AWS.

        <BlockDeviceMappings>
          <member>
            <NoDevice>true</NoDevice>
            <DeviceName>/dev/sdc</DeviceName>
          </member>
          <member>
            <NoDevice>true</NoDevice>
            <DeviceName>/dev/sde</DeviceName>
          </member>
          <member>
            <DeviceName>/dev/sda1</DeviceName>
            <Ebs>
              <VolumeType>standard</VolumeType>
              <DeleteOnTermination>true</DeleteOnTermination>
              <VolumeSize>20</VolumeSize>
            </Ebs>
          </member>
          <member>
            <NoDevice>true</NoDevice>
            <DeviceName>/dev/sdb</DeviceName>
          </member>
          <member>
            <NoDevice>true</NoDevice>
            <DeviceName>/dev/sdd</DeviceName>
          </member>
        </BlockDeviceMappings>

AWS returns correct information as I set on the AWS console, so bug is from parsing response in boto.

https://github.com/boto/boto/blob/2.38.0/boto/ec2/blockdevicemapping.py#L112-L116
I think above method should initialize self.current_value to None if name is not in ("ebs", "virtualname"). Shouldn't it?

Another thing.
LaunchConfiguration returned by get_all_launch_configurations has just BDM for block_device_mappings.
(https://github.com/boto/boto/blob/2.38.0/boto/ec2/autoscale/launchconfig.py#L214)
But To create LaunchConfiguration, I have to set list of BDM to block_device_mappings.
How about changing it to just BDM object, not list of BDM?

@jamesls jamesls added the bug label Jun 26, 2015
@jamesls jamesls added the ec2 label Nov 12, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants