summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorVishvananda Ishaya <vishvananda@gmail.com>2012-03-01 16:52:07 -0800
committerVishvananda Ishaya <vishvananda@gmail.com>2012-03-02 11:59:23 -0800
commit0d78045e72efe7313ca54e726dd403793eb30b52 (patch)
tree9c4f7beccf881c0b75a699a73779ba6d10c13886 /nova/api
parent8a530832c599f8866e98947976d74a5332d877af (diff)
Fixes for ec2 images
* Fixes s3 image service to convert back to uuids on update * Adds exception for attempt to update an unowned image * Adds error messages to ec2 for failure cases * Adds tests to verify changes * Fixes bug 942865 Change-Id: I35331c635756f10c02b30dd43ab3fe0ad98bc28c
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/ec2/cloud.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/nova/api/ec2/cloud.py b/nova/api/ec2/cloud.py
index 5240af016..b27f79c62 100644
--- a/nova/api/ec2/cloud.py
+++ b/nova/api/ec2/cloud.py
@@ -1427,6 +1427,9 @@ class CloudController(object):
def register_image(self, context, image_location=None, **kwargs):
if image_location is None and 'name' in kwargs:
image_location = kwargs['name']
+ if image_location is None:
+ raise exception.EC2APIError(_('imageLocation is required'))
+
metadata = {'properties': {'image_location': image_location}}
if 'root_device_name' in kwargs:
@@ -1501,7 +1504,11 @@ class CloudController(object):
del(image['id'])
image['is_public'] = (operation_type == 'add')
- return self.image_service.update(context, internal_id, image)
+ try:
+ return self.image_service.update(context, internal_id, image)
+ except exception.ImageNotAuthorized:
+ msg = _('Not allowed to modify attributes for image %s')
+ raise exception.EC2APIError(msg % image_id)
def update_image(self, context, image_id, **kwargs):
internal_id = ec2utils.ec2_id_to_id(image_id)