SchedulerHintsTestCase.test_create_missing_server fails on F17

Bug #1037201 reported by Dan Prince
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
High
Dan Prince

Bug Description

As of this morning I'm getting unit test failures on Fedora 17 when running the Nova unit tests:

SchedulerHintsTestCase
    test_create_missing_server ^[[31mERROR^[[0m^[[31m 0.35^[[0m

======================================================================
ERROR: Test create with malformed body
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/dprince/projects/nova/nova/tests/api/openstack/compute/contrib/test_scheduler_hints.py", line 112, in test_create_missing_server
    res = req.get_response(self.app)
  File "/home/dprince/projects/nova/.venv/lib/python2.7/site-packages/webob/request.py", line 1053, in get_response
    application, catch_exc_info=False)
  File "/home/dprince/projects/nova/.venv/lib/python2.7/site-packages/webob/request.py", line 1022, in call_application
    app_iter = application(self.environ, start_response)
  File "/home/dprince/projects/nova/.venv/lib/python2.7/site-packages/webob/dec.py", line 159, in __call__
    return resp(environ, start_response)
  File "/home/dprince/projects/nova/.venv/lib/python2.7/site-packages/routes/middleware.py", line 131, in __call__
    response = self.app(environ, start_response)
  File "/home/dprince/projects/nova/.venv/lib/python2.7/site-packages/webob/dec.py", line 159, in __call__
    return resp(environ, start_response)
  File "/home/dprince/projects/nova/.venv/lib/python2.7/site-packages/webob/dec.py", line 147, in __call__
    resp = self.call_func(req, *args, **self.kwargs)
  File "/home/dprince/projects/nova/.venv/lib/python2.7/site-packages/webob/dec.py", line 208, in call_func
    return self.func(req, *args, **kwargs)
  File "/home/dprince/projects/nova/nova/api/openstack/wsgi.py", line 864, in __call__
    content_type, body, accept)
  File "/home/dprince/projects/nova/nova/api/openstack/wsgi.py", line 907, in _process_stack
    request, action_args)
  File "/home/dprince/projects/nova/nova/api/openstack/wsgi.py", line 797, in pre_process_extensions
    response = gen.next()
  File "/home/dprince/projects/nova/nova/api/openstack/compute/contrib/disk_config.py", line 142, in create
    self._set_disk_config(body['server'])
KeyError: "'server'\n-------------------- <snip>

------

Dan Prince (dan-prince)
Changed in nova:
assignee: nobody → Dan Prince (dan-prince)
importance: Undecided → High
status: New → In Progress
Revision history for this message
Dan Prince (dan-prince) wrote :
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/11420

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/11420
Committed: http://github.com/openstack/nova/commit/00f0b170ec15299b20c345fa1f66f21185c2dc79
Submitter: Jenkins
Branch: master

commit 00f0b170ec15299b20c345fa1f66f21185c2dc79
Author: Dan Prince <email address hidden>
Date: Wed Aug 15 13:07:19 2012 -0400

    Update disk config to check for 'server' in req.

    Updates the disk config extension to check for 'server' in the
    request body before trying to use it. This avoids a potential
    KeyError exception. Given that we already validate the 'server'
    dict in servers.py and raise a proper exception there this seems
    reasonable to me... no reason to duplicate all of the validation
    logic.

    The reason this change was able to make it into Nova to begin
    with is that the Extensions loader orders things differently
    depending on the OS/python version being used. I tested this
    by running SchedulerHintsTestCase.test_create_missing_server
    on both Fedora 16 (passes) and Fedora 17 (fails). The problem
    only manifests itself when the disk config extension gets called
    before the scheduler_hints extension. To fix this issue
    I've updated the scheduler_hints extensions in this patchset
    to simply pass when 'server' isn't defined which like above seems
    reasonable because we already validate this in servers.py.

    As part of this fix I'm also moving test_create_missing_server out
    of the Scheduler Hints tests and into a new ServersAllExtensionsTestCase
    class in test_servers.py which explicitly tests for things with *all*
    extensions enabled. As part of the move I also updated the test to
    look for HTTP 422 Unprocessable Entity which is what we throw when
    'server' doesn't exist in a POST to servers (the correct exception).

    Fixes LP Bug #1037201.

    Change-Id: I912fc1234b2e7a76ecc54140f4a31c2e32fdfa98

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → folsom-3
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: folsom-3 → 2012.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.