diff options
author | Michael Still <mikal@stillhq.com> | 2012-08-23 17:39:31 +1000 |
---|---|---|
committer | Michael Still <mikal@stillhq.com> | 2012-08-23 17:49:56 +1000 |
commit | 8527f3b77773d047272624af8abdbc9356a257f2 (patch) | |
tree | de02ab41c0a0b5760a68d9368e89f40c67ee9399 | |
parent | 9fecad9e6f7803f3422e7769c01ba3b9076ed308 (diff) | |
download | nova-8527f3b77773d047272624af8abdbc9356a257f2.tar.gz nova-8527f3b77773d047272624af8abdbc9356a257f2.tar.xz nova-8527f3b77773d047272624af8abdbc9356a257f2.zip |
Provide a hint for missing EC2 image ids
EC2 image ids are allocated when the images are listed for the first
time. Remind users of this if they specify an image id which does
not exist. Resolves bug 961451.
Change-Id: Id7326ba32e58051dbbf25c3c940fd0c9cc611ff3
-rw-r--r-- | nova/api/ec2/cloud.py | 2 | ||||
-rw-r--r-- | nova/exception.py | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/nova/api/ec2/cloud.py b/nova/api/ec2/cloud.py index 834b5b7e2..c252684a3 100644 --- a/nova/api/ec2/cloud.py +++ b/nova/api/ec2/cloud.py @@ -1181,7 +1181,7 @@ class CloudController(object): if image: image_state = self._get_image_state(image) else: - raise exception.ImageNotFound(image_id=kwargs['image_id']) + raise exception.ImageNotFoundEC2(image_id=kwargs['image_id']) if image_state != 'available': raise exception.EC2APIError(_('Image must be available')) diff --git a/nova/exception.py b/nova/exception.py index f89b3e541..83c3f9c03 100644 --- a/nova/exception.py +++ b/nova/exception.py @@ -486,6 +486,13 @@ class ImageNotFound(NotFound): message = _("Image %(image_id)s could not be found.") +class ImageNotFoundEC2(ImageNotFound): + message = _("Image %(image_id)s could not be found. The nova EC2 API " + "assigns image ids dynamically when they are listed for the " + "first time. Have you listed image ids since adding this " + "image?") + + class ProjectNotFound(NotFound): message = _("Project %(project_id)s could not be found.") |