Updates to that S3ImageService kernel_id and ramdisk_id mappings work with

EC2 API.
This commit is contained in:
Dan Prince 2011-02-14 19:51:51 -05:00
parent 0a93ef16bb
commit f1e536fb29
3 changed files with 6 additions and 3 deletions

View File

@ -883,6 +883,9 @@ class CloudController(object):
% attribute) % attribute)
try: try:
image = self.image_service.show(context, image_id) image = self.image_service.show(context, image_id)
image = self._format_image(context,
self.image_service.show(context,
image_id))
except IndexError: except IndexError:
raise exception.ApiError(_('invalid id: %s') % image_id) raise exception.ApiError(_('invalid id: %s') % image_id)
result = {'image_id': image_id, 'launchPermission': []} result = {'image_id': image_id, 'launchPermission': []}

View File

@ -103,9 +103,9 @@ class API(base.Base):
if not is_vpn: if not is_vpn:
image = self.image_service.show(context, image_id) image = self.image_service.show(context, image_id)
if kernel_id is None: if kernel_id is None:
kernel_id = image.get('kernelId', None) kernel_id = image.get('kernel_id', None)
if ramdisk_id is None: if ramdisk_id is None:
ramdisk_id = image.get('ramdiskId', None) ramdisk_id = image.get('ramdisk_id', None)
# No kernel and ramdisk for raw images # No kernel and ramdisk for raw images
if kernel_id == str(FLAGS.null_kernel): if kernel_id == str(FLAGS.null_kernel):
kernel_id = None kernel_id = None

View File

@ -94,7 +94,7 @@ class S3ImageService(service.BaseImageService):
if FLAGS.connection_type == 'fake': if FLAGS.connection_type == 'fake':
return {'imageId': 'bar'} return {'imageId': 'bar'}
result = self.index(context) result = self.index(context)
result = [i for i in result if i['imageId'] == image_id] result = [i for i in result if i['id'] == image_id]
if not result: if not result:
raise exception.NotFound(_('Image %s could not be found') raise exception.NotFound(_('Image %s could not be found')
% image_id) % image_id)