summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorBrian Elliott <brian.elliott@rackspace.com>2012-08-10 15:43:47 +0000
committerBrian Elliott <brian.elliott@rackspace.com>2012-08-10 20:53:23 +0000
commit197a354300df7f947d080aac964dbd2c774768f0 (patch)
treed8c02ab73d9a35ce629c129af46105d80230d6a0 /nova/api
parent2ef345534afe2d1640dd1d7ad42454d477ca2a94 (diff)
Fix HTTP 500 on bad server create
Fix scheduler hint extension to check for missing 'server' attribute in the body. Return a HTTP 400. (not 500) bug 1035356 Change-Id: Ifdf8b85e255fd199f15781c8b6c25d421eee7878
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/openstack/compute/contrib/scheduler_hints.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/nova/api/openstack/compute/contrib/scheduler_hints.py b/nova/api/openstack/compute/contrib/scheduler_hints.py
index 86b7564bd..4bff779a5 100644
--- a/nova/api/openstack/compute/contrib/scheduler_hints.py
+++ b/nova/api/openstack/compute/contrib/scheduler_hints.py
@@ -46,8 +46,13 @@ class SchedulerHintsController(wsgi.Controller):
@wsgi.extends
def create(self, req, body):
hints = self._extract_scheduler_hints(body)
- body['server']['scheduler_hints'] = hints
- yield
+
+ if 'server' in body:
+ body['server']['scheduler_hints'] = hints
+ yield
+ else:
+ msg = _("Missing server attribute")
+ raise webob.exc.HTTPBadRequest(reason=msg)
class Scheduler_hints(extensions.ExtensionDescriptor):