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).
Reviewed: https:/ /review. openstack. org/11420 github. com/openstack/ nova/commit/ 00f0b170ec15299 b20c345fa1f66f2 1185c2dc79
Committed: http://
Submitter: Jenkins
Branch: master
commit 00f0b170ec15299 b20c345fa1f66f2 1185c2dc79
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 estCase. test_create_ missing_ server
with is that the Extensions loader orders things differently
depending on the OS/python version being used. I tested this
by running SchedulerHintsT
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 sionsTestCase
of the Scheduler Hints tests and into a new ServersAllExten
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: I912fc1234b2e7a 76ecc54140f4a31 c2e32fdfa98