scheduler hints can be injected when extension is off
Bug #1025737 reported by
Brian Waldon
This bug affects 2 people
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Compute (nova) |
Fix Released
|
High
|
Sean Dague |
Bug Description
The scheduler hints extension converts a server create request like {'server': {'name': 'foo'}, 'os:scheduler_
I would expect when the extension is off that any scheduler hints would be ignored.
Changed in nova: | |
assignee: | nobody → jiang, yunhong (yunhong-jiang) |
Changed in nova: | |
status: | Fix Committed → Fix Released |
Changed in nova: | |
milestone: | folsom-3 → 2012.2 |
To post a comment you must log in.
As the extension code will be executed before servers.py, I didn't think out a good method to distinguish whether the "scheduler_hints" in request body is set by the schedule hints extensions or by user directly.
I considered that it's possible that the schedule hints extension set the req's environment, like followed draft show. With this changes, even user set the "scheduler_hints" in the server dictionary, it will not be utilized. The servers.py always get scheduler hints from the wsgi environment.
However, I'm not quite sure if this is the right and clean solution, because I'm not sure if the wsgi environment fits for this purpose. Although my quick test showed it works.
Brian, how do you think of this? If it's acceptable, I will do more testing on it.
Thanks
--jyh
diff --git a/nova/ api/openstack/ compute/ contrib/ scheduler_ hints.py b/nova/api/op api/openstack/ compute/ contrib/ scheduler_ hints.py api/openstack/ compute/ contrib/ scheduler_ hints.py ontroller( wsgi.Controller ): scheduler_ hints(body) ]['scheduler_ hints'] = hints 'nova.scheduler _hints' ] = hints
index 86b7564..d97d0bd 100644
--- a/nova/
+++ b/nova/
@@ -46,7 +46,7 @@ class SchedulerHintsC
@wsgi.extends
def create(self, req, body):
hints = self._extract_
- body['server'
+ req.environ[
yield
diff --git a/nova/ api/openstack/ compute/ servers. py b/nova/ api/openstack/ compute/ api/openstack/ compute/ servers. py api/openstack/ compute/ servers. py wsgi.Controller ):
min_ count = max_count
index 0b37b5c..42a5036 100644
--- a/nova/
+++ b/nova/
@@ -678,7 +678,7 @@ class Controller(
- scheduler_hints = server_
+ scheduler_hints = req.environ[
try:
_ get_inst_ type = instance_ types.get_ instance_ type_by_ flavor_ id
~