diff options
| author | Nikola Dipanov <ndipanov@redhat.com> | 2013-05-20 17:36:49 +0200 |
|---|---|---|
| committer | Nikola Dipanov <ndipanov@redhat.com> | 2013-05-21 19:16:39 +0200 |
| commit | 65a6264c236a779712694d2379cfe4f9e46e2732 (patch) | |
| tree | c5811024f822cab08aea00e4c4f06e472ddf7d7c /nova/api | |
| parent | 5c3113b066e61cbc5d8d4d464f8200d4cb5e8395 (diff) | |
| download | nova-65a6264c236a779712694d2379cfe4f9e46e2732.tar.gz nova-65a6264c236a779712694d2379cfe4f9e46e2732.tar.xz nova-65a6264c236a779712694d2379cfe4f9e46e2732.zip | |
Disallow resize if image not available
If a resize is attempted on an instance that was started from an image
that has since been deleted, a resize will fail. This change makes error
reporting a bit cleaner.
This change is needed since in order to actually properly support
resize/migrate when the image is deleted - it is necessary for nova to keep
a copy of the image metadata and re-use it in case of migration/resize.
Fixes bug: 1160773
Fixes bug: 1177001
Change-Id: Ifaea71f79c97046a4cde094e3a5e676772fcceb4
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/openstack/compute/servers.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/nova/api/openstack/compute/servers.py b/nova/api/openstack/compute/servers.py index 2df16c886..24b760401 100644 --- a/nova/api/openstack/compute/servers.py +++ b/nova/api/openstack/compute/servers.py @@ -1098,6 +1098,17 @@ class Controller(wsgi.Controller): except exception.InstanceInvalidState as state_error: common.raise_http_conflict_for_instance_invalid_state(state_error, 'resize') + except exception.ImageNotAuthorized as image_error: + msg = _("You are not authorized to access the image " + "the instance was started with.") + raise exc.HTTPUnauthorized(explanation=msg) + except exception.ImageNotFound as image_error: + msg = _("Image that the instance was started " + "with could not be found.") + raise exc.HTTPBadRequest(explanation=msg) + except exception.Invalid: + msg = _("Invalid instance image.") + raise exc.HTTPBadRequest(explanation=msg) return webob.Response(status_int=202) |
