Uploaded image for project: 'Libcloud'
  1. Libcloud
  2. LIBCLOUD-282

add support to EC2 NodeDriver for passing Block Device Mappings (for ephemeral instance storage)

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 0.11.2
    • Fix Version/s: 0.12.1
    • Component/s: Compute
    • Labels:

      Description

      When creating an EC2 node that utilizes EBS-backed root storage the ephemeral instance storage disks are not available unless explicitly requested by including BlockDeviceMappings in the call to RunInstances.

      This patch adds support for passing an array of BlockDeviceMappings to the EC2NodeDriver's create_node() function using the ex_blockdevicemappings kwarg.

      Example:

      ```
      ec2_ephemeral_mappings = [

      {'DeviceName': '/dev/sdb', 'VirtualName': 'ephemeral0'}

      ,

      {'DeviceName': '/dev/sdc', 'VirtualName': 'ephemeral1'}

      ,

      {'DeviceName': '/dev/sdd', 'VirtualName': 'ephemeral2'}

      ]

      ec2.create_node(name=name, image=image, size=size, ex_blockdevicemappings=ec2_ephemeral_mappings)

      [

      {'DeviceName': '/dev/sdb', 'VirtualName': 'ephemeral0'}

      ]
      ```

      also on github, branch: https://github.com/pantheon-systems/libcloud/tree/ec2_block_dev_mappings

        Activity

        Hide
        kami Tomaz Muraus added a comment -

        I've added a test case and merged your patch into trunk - http://svn.apache.org/viewvc?view=revision&revision=r1438350. Thanks.

        No or little tests for other 'ex_' arguments and methods is not a good argument for not adding tests for the new functionality. It was mostly us being sloppy and not enforcing "tests for everything" rule well enough. One of the most important things besides good code reviews which helps to keep the code quality high and prevents regressions are tests.

        Show
        kami Tomaz Muraus added a comment - I've added a test case and merged your patch into trunk - http://svn.apache.org/viewvc?view=revision&revision=r1438350 . Thanks. No or little tests for other 'ex_' arguments and methods is not a good argument for not adding tests for the new functionality. It was mostly us being sloppy and not enforcing "tests for everything" rule well enough. One of the most important things besides good code reviews which helps to keep the code quality high and prevents regressions are tests.
        Hide
        joe.miller joe miller added a comment -

        Anything else needed for this? I looked at adding tests but they did not really seem necessary for this as the API seems to more or less silently accept these params. Also did not see tests for many of the other ex_* kwargs in the create_node() method.

        Show
        joe.miller joe miller added a comment - Anything else needed for this? I looked at adding tests but they did not really seem necessary for this as the API seems to more or less silently accept these params. Also did not see tests for many of the other ex_* kwargs in the create_node() method.
        Hide
        kami Tomaz Muraus added a comment - - edited

        Edit: Ignore this comment. Meant to added it to a different ticket

        Show
        kami Tomaz Muraus added a comment - - edited Edit: Ignore this comment. Meant to added it to a different ticket
        Hide
        kami Tomaz Muraus added a comment -

        If you need help with the tests, let us know.

        There should also already be a plenty of examples in libcloud/test/compute/test_ec2.py.

        Show
        kami Tomaz Muraus added a comment - If you need help with the tests, let us know. There should also already be a plenty of examples in libcloud/test/compute/test_ec2.py.
        Hide
        kami Tomaz Muraus added a comment -

        Thanks.

        Patch looks good, only thing which is missing are tests.

        I'm happy to merge it as soon as you add the tests.

        Show
        kami Tomaz Muraus added a comment - Thanks. Patch looks good, only thing which is missing are tests. I'm happy to merge it as soon as you add the tests.

          People

          • Assignee:
            kami Tomaz Muraus
            Reporter:
            joe.miller joe miller
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development