diff options
| author | Jenkins <jenkins@review.openstack.org> | 2012-08-14 05:11:01 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2012-08-14 05:11:01 +0000 |
| commit | 338564dbc577504ff7d08a20eb21b616bd39a1fe (patch) | |
| tree | 07f4e8010d86402b175d4f6a56bb1fd55dfd1b99 /nova/api | |
| parent | 7af16893514bd27be51cf5e425679ddcce07688a (diff) | |
| parent | 197a354300df7f947d080aac964dbd2c774768f0 (diff) | |
| download | nova-338564dbc577504ff7d08a20eb21b616bd39a1fe.tar.gz nova-338564dbc577504ff7d08a20eb21b616bd39a1fe.tar.xz nova-338564dbc577504ff7d08a20eb21b616bd39a1fe.zip | |
Merge "Fix HTTP 500 on bad server create"
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/openstack/compute/contrib/scheduler_hints.py | 9 |
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): |
