From 8527f3b77773d047272624af8abdbc9356a257f2 Mon Sep 17 00:00:00 2001 From: Michael Still Date: Thu, 23 Aug 2012 17:39:31 +1000 Subject: 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 --- nova/api/ec2/cloud.py | 2 +- nova/exception.py | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) 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.") -- cgit