summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/openstack/servers.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/nova/api/openstack/servers.py b/nova/api/openstack/servers.py
index e9bc0a797..29c491716 100644
--- a/nova/api/openstack/servers.py
+++ b/nova/api/openstack/servers.py
@@ -250,8 +250,15 @@ class Controller(wsgi.Controller):
if 'name' in inst_dict['server']:
name = inst_dict['server']['name']
- if not isinstance(name, basestring) or name == '':
- return exc.HTTPBadRequest()
+ if not isinstance(name, basestring):
+ msg = _("Server name is not a string or unicode")
+ return exc.HTTPBadRequest(msg)
+
+ name = name.strip()
+
+ if name == '':
+ msg = _("Server name is an empty string")
+ return exc.HTTPBadRequest(msg)
update_dict['display_name'] = name