summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
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):