Skip to content
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 from

Conversation

@cderamus
Copy link
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 12 commits Dec 26, 2013
…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.
@@ -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.

Copy link
@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.

Copy link
@cderamus

cderamus Jan 12, 2014

Author Contributor

Done

"""
Create an Amazon Machine Image based off of an EBS-backed instance.
:param instance: Instance of ``Node``

This comment has been minimized.

Copy link
@Kami

Kami Jan 12, 2014

Member

For consistency, the argument should be called node.

This comment has been minimized.

Copy link
@cderamus

cderamus Jan 12, 2014

Author Contributor

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

below.
:type block_device_mapping: ``list`` of ``dict``
:param no_reboot: Whether or not to shutdown the instance before

This comment has been minimized.

Copy link
@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.

raise AttributeError(
'block_device_mapping not list or tuple')

for idx, mapping in enumerate(block_device_mapping):

This comment has been minimized.

Copy link
@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.

Copy link
@cderamus

cderamus Jan 12, 2014

Author Contributor

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

…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
Copy link
Member

Kami commented Jan 12, 2014

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.