summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorDan Prince <dprince@redhat.com>2012-03-23 15:03:19 -0400
committerDan Prince <dprince@redhat.com>2012-03-29 09:52:06 -0400
commitc7f526fae6062e9ab51f65474af71d496aa66554 (patch)
treeddd034b7fcbe6bb694c452798b63d801718fb0bb /nova/api
parent998e57b29629946a9da96db3aed013ab895dc482 (diff)
Add validation for OSAPI server name length.
Fixes LP Bug #962515. Change-Id: Iee895604f8e9101a341a5909fc5ba2dd8e708b4b
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/openstack/compute/servers.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/nova/api/openstack/compute/servers.py b/nova/api/openstack/compute/servers.py
index e6a8fdcdb..8ca49b64f 100644
--- a/nova/api/openstack/compute/servers.py
+++ b/nova/api/openstack/compute/servers.py
@@ -505,6 +505,10 @@ class Controller(wsgi.Controller):
msg = _("Server name is an empty string")
raise exc.HTTPBadRequest(explanation=msg)
+ if not len(value) < 256:
+ msg = _("Server name must be less than 256 characters.")
+ raise exc.HTTPBadRequest(explanation=msg)
+
def _get_injected_files(self, personality):
"""
Create a list of injected files from the personality attribute