summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2012-10-25 09:42:45 +0000
committerGerrit Code Review <review@openstack.org>2012-10-25 09:42:45 +0000
commit8417af68d94ee2c0bf433a99bec1447df9c61025 (patch)
tree17b9ebb610fef29ae109b548b5abf29dbd59aff0 /nova/api
parent992a23cfaa5e2d73533998a6861921f840cbcb69 (diff)
parentdb7798a973bb05af5d4668a9f9b20ce62e8a47af (diff)
Merge "Fix Incorrect Exception when metadata is over 255 characters"
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/openstack/compute/server_metadata.py3
-rw-r--r--nova/api/openstack/compute/servers.py4
2 files changed, 7 insertions, 0 deletions
diff --git a/nova/api/openstack/compute/server_metadata.py b/nova/api/openstack/compute/server_metadata.py
index dfb4b55a8..4e5a3ee02 100644
--- a/nova/api/openstack/compute/server_metadata.py
+++ b/nova/api/openstack/compute/server_metadata.py
@@ -129,6 +129,9 @@ class Controller(object):
except exception.InvalidMetadata as error:
raise exc.HTTPBadRequest(explanation=unicode(error))
+ except exception.InvalidMetadataSize as error:
+ raise exc.HTTPRequestEntityTooLarge(explanation=unicode(error))
+
except exception.QuotaError as error:
raise exc.HTTPRequestEntityTooLarge(explanation=unicode(error),
headers={'Retry-After': 0})
diff --git a/nova/api/openstack/compute/servers.py b/nova/api/openstack/compute/servers.py
index 6574908bc..b8f52dda4 100644
--- a/nova/api/openstack/compute/servers.py
+++ b/nova/api/openstack/compute/servers.py
@@ -880,6 +880,8 @@ class Controller(wsgi.Controller):
raise exc.HTTPBadRequest(explanation=unicode(error))
except exception.InvalidMetadata as error:
raise exc.HTTPBadRequest(explanation=unicode(error))
+ except exception.InvalidMetadataSize as error:
+ raise exc.HTTPRequestEntityTooLarge(explanation=unicode(error))
except exception.ImageNotFound as error:
msg = _("Can not find requested image")
raise exc.HTTPBadRequest(explanation=msg)
@@ -1231,6 +1233,8 @@ class Controller(wsgi.Controller):
raise exc.HTTPNotFound(explanation=msg)
except exception.InvalidMetadata as error:
raise exc.HTTPBadRequest(explanation=unicode(error))
+ except exception.InvalidMetadataSize as error:
+ raise exc.HTTPRequestEntityTooLarge(explanation=unicode(error))
except exception.ImageNotFound:
msg = _("Cannot find image for rebuild")
raise exc.HTTPBadRequest(explanation=msg)