summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2012-03-06 19:59:21 +0000
committerGerrit Code Review <review@openstack.org>2012-03-06 19:59:21 +0000
commit225286d8bb36c34334d3da73e96e2117121537c3 (patch)
tree7bb01fe7ec296e1ed49c5eb435a6009bc46db8c1 /nova/api
parent80eaaad9b3377ccc80382bf2f91ffb70b23ab106 (diff)
parent0d78045e72efe7313ca54e726dd403793eb30b52 (diff)
Merge "Fixes for ec2 images"
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 2badde9b9..f42b1b4ac 100644
--- a/nova/api/ec2/cloud.py
+++ b/nova/api/ec2/cloud.py
@@ -1434,6 +1434,9 @@ class CloudController(object):
def register_image(self, context, image_location=None, **kwargs):
if image_location is None and kwargs.get('name'):
image_location = kwargs['name']
+ if image_location is None:
+ raise exception.EC2APIError(_('imageLocation is required'))
+
metadata = {'properties': {'image_location': image_location}}
if kwargs.get('name'):
@@ -1513,7 +1516,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)