New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LIBCLOUD-494: Add image extension methods for create/copy #222

Closed
wants to merge 13 commits into
base: trunk
from

Conversation

Projects
None yet
2 participants
@cderamus
Contributor

cderamus commented Jan 12, 2014

This PR adds new extension methods to copy AMIs between Amazon regions and also adds the ability to create an image from an EBS backed instance. Unit tests and new fixtures are included.

cderamus and others added some commits Dec 26, 2013

Chris DeRamus
Issue LIBCLOUD-494: Add extension methods to support additional EC2 i…
…mage calls. The first is ex_copy_image which is used to copy Amazon Machine Images between regions and the second is ex_create_image which can be used to create an AMI from an EBS backed instance.
@Kami

View changes

Show outdated Hide outdated libcloud/compute/drivers/ec2.py
@@ -1566,6 +1566,105 @@ def delete_key_pair(self, key_pair):
namespace=NAMESPACE)
return element == 'true'
def ex_copy_image(self, source_region, image, name=None, description=None):
"""
Copy an Amazon Machine Image from one region to another.

This comment has been minimized.

@Kami

Kami Jan 12, 2014

Member

The to be more clear about what is going on, the description should probably say "Copy an Amazon Machine Image from the specified source region to the current region.".

@Kami

Kami Jan 12, 2014

Member

The to be more clear about what is going on, the description should probably say "Copy an Amazon Machine Image from the specified source region to the current region.".

This comment has been minimized.

@cderamus

cderamus Jan 12, 2014

Contributor

Done

@cderamus

cderamus Jan 12, 2014

Contributor

Done

@Kami

View changes

Show outdated Hide outdated libcloud/compute/drivers/ec2.py
"""
Create an Amazon Machine Image based off of an EBS-backed instance.
:param instance: Instance of ``Node``

This comment has been minimized.

@Kami

Kami Jan 12, 2014

Member

For consistency, the argument should be called node.

@Kami

Kami Jan 12, 2014

Member

For consistency, the argument should be called node.

This comment has been minimized.

@cderamus

cderamus Jan 12, 2014

Contributor

Roger, blind copy paste there which I should have changed.

@cderamus

cderamus Jan 12, 2014

Contributor

Roger, blind copy paste there which I should have changed.

@Kami

View changes

Show outdated Hide outdated libcloud/compute/drivers/ec2.py
below.
:type block_device_mapping: ``list`` of ``dict``
:param no_reboot: Whether or not to shutdown the instance before

This comment has been minimized.

@Kami

Kami Jan 12, 2014

Member

I know that the EC2 API calls the argument NoReboot, but I find reboot more clear and obvious than no_reboot.

@Kami

Kami Jan 12, 2014

Member

I know that the EC2 API calls the argument NoReboot, but I find reboot more clear and obvious than no_reboot.

@Kami

View changes

Show outdated Hide outdated libcloud/compute/drivers/ec2.py
raise AttributeError(
'block_device_mapping not list or tuple')
for idx, mapping in enumerate(block_device_mapping):

This comment has been minimized.

@Kami

Kami Jan 12, 2014

Member

Hm, this code looks familiar, have I see it before? :)

If there is a similar code repeat elsewhere in the driver, we should try to refactor it in a separate method.

@Kami

Kami Jan 12, 2014

Member

Hm, this code looks familiar, have I see it before? :)

If there is a similar code repeat elsewhere in the driver, we should try to refactor it in a separate method.

This comment has been minimized.

@cderamus

cderamus Jan 12, 2014

Contributor

It's a touch different than the one in create_node, but I can certainly refactor and make a utility function for it.

@cderamus

cderamus Jan 12, 2014

Contributor

It's a touch different than the one in create_node, but I can certainly refactor and make a utility function for it.

Chris DeRamus
Adding a new utility function _get_block_device_mapping_params which …
…is used for create_node and ex_create_image_from_node. Changed no_reboot -> reboot to make things a bit more clear within ex_create_image_from_node.
@Kami

This comment has been minimized.

Show comment
Hide comment
@Kami

Kami Jan 12, 2014

Member

Fixed the build issue and merged patch into trunk. Thanks!

Member

Kami commented Jan 12, 2014

Fixed the build issue and merged patch into trunk. Thanks!

@asfgit asfgit closed this in b81a63a Jan 12, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment