summaryrefslogtreecommitdiffstats
path: root/nova
diff options
context:
space:
mode:
authorIsaku Yamahata <yamahata@valinux.co.jp>2011-06-22 12:54:22 +0900
committerIsaku Yamahata <yamahata@valinux.co.jp>2011-06-22 12:54:22 +0900
commitd81d75bec04fe19492544e5bf7548dce5a2366ad (patch)
tree554dd380f8c2e33725d9f824c734e32a22ae6fc6 /nova
parent91cc2d5f974d67d91e1e783aaec105c489a47cce (diff)
downloadnova-d81d75bec04fe19492544e5bf7548dce5a2366ad.tar.gz
nova-d81d75bec04fe19492544e5bf7548dce5a2366ad.tar.xz
nova-d81d75bec04fe19492544e5bf7548dce5a2366ad.zip
api/ec2: make CreateImage pass unit tests
Diffstat (limited to 'nova')
-rw-r--r--nova/api/ec2/cloud.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/nova/api/ec2/cloud.py b/nova/api/ec2/cloud.py
index 703dd82b4..c25db9014 100644
--- a/nova/api/ec2/cloud.py
+++ b/nova/api/ec2/cloud.py
@@ -1346,7 +1346,7 @@ class CloudController(object):
state_description = instance['state_description']
# NOTE(yamahata): timeout and error?
- src_image = self.image_service.show(context, instance['image_id'])
+ src_image = self._get_image(context, instance['image_ref'])
properties = src_image['properties']
if instance['root_device_name']:
properties['root_device_name'] = instance['root_device_name']
@@ -1372,7 +1372,7 @@ class CloudController(object):
# NOTE(yamahata): Should we wait for snapshot creation?
# Linux LVM snapshot creation completes in
# short time, it doesn't matter for now.
- snapshot = self.volume_api.create_snapshot(
+ snapshot = self.volume_api.create_snapshot_force(
context, volume_id=volume_id, name=vol['display_name'],
description=vol['display_description'])
m['snapshot_id'] = snapshot['id']
@@ -1388,9 +1388,9 @@ class CloudController(object):
assert (virtual_name == 'swap' or
virtual_name.startswith('ephemeral'))
- device_name = m['device_name']
- if device_name in [b.device_name for b in mapping
- if not b.no_device]:
+ device_name = m['device']
+ if device_name in [b['device_name'] for b in mapping
+ if not b.get('no_device', False)]:
continue
# NOTE(yamahata): swap and ephemeral devices are specified in
@@ -1402,7 +1402,7 @@ class CloudController(object):
properties['block_device_mapping'] = mapping
for attr in ('status', 'location', 'id'):
- del src_image[attr]
+ src_image.pop(attr, None)
image_id = self._register_image(context, src_image)