From 98ff29d13af9e0c1fa96e49e68939634c24ad2c3 Mon Sep 17 00:00:00 2001 From: Prem Karat Date: Fri, 3 May 2013 22:36:04 +0530 Subject: Fix to disallow server name with all blank spaces * Nova CLI allows server name to be created with all blank characters. This fix will disallow a server name with all blank spaces during server/instance creation as well as while updating/renaming a server * Adding unit tests to test the above scenarios (create & rename server with blank spaces) Fixes bug 1175956 Change-Id: I58af207c4a6b8579bb172d4bb612e0aa2aa6b498 --- nova/api/openstack/compute/servers.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'nova/api') diff --git a/nova/api/openstack/compute/servers.py b/nova/api/openstack/compute/servers.py index 41c3b92a5..f47ac56a7 100644 --- a/nova/api/openstack/compute/servers.py +++ b/nova/api/openstack/compute/servers.py @@ -580,6 +580,8 @@ class Controller(wsgi.Controller): def _check_string_length(self, value, name, max_length=None): try: + if isinstance(value, basestring): + value = value.strip() utils.check_string_length(value, name, min_length=1, max_length=max_length) except exception.InvalidInput as e: -- cgit