Merge lp:~cerberus/nova/lp736343 into lp:~hudson-openstack/nova/trunk

Proposed by Matt Dietz
Status: Merged
Approved by: Rick Harris
Approved revision: 815
Merged at revision: 818
Proposed branch: lp:~cerberus/nova/lp736343
Merge into: lp:~hudson-openstack/nova/trunk
Diff against target: 38 lines (+5/-1)
2 files modified
nova/api/openstack/flavors.py (+2/-1)
nova/tests/api/openstack/test_flavors.py (+3/-0)
To merge this branch: bzr merge lp:~cerberus/nova/lp736343
Reviewer Review Type Date Requested Status
Rick Harris (community) Approve
Josh Kearney (community) Approve
Ken Pepple (community) Approve
Review via email: mp+53691@code.launchpad.net

Description of the change

Fixes lp736343 - Incorrect mapping of instance type id to flavor id in Openstack API

To post a comment you must log in.
lp:~cerberus/nova/lp736343 updated
815. By Matt Dietz

Dumb

Revision history for this message
Ken Pepple (ken-pepple) wrote :

lgtm -- i don't think i told jk0 about the difference between id and flavorid when i wrote instance_types

review: Approve
Revision history for this message
Josh Kearney (jk0) wrote :

lgtm

review: Approve
Revision history for this message
Rick Harris (rconradharris) wrote :

lgtm

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'nova/api/openstack/flavors.py'
2--- nova/api/openstack/flavors.py 2011-03-09 18:10:45 +0000
3+++ nova/api/openstack/flavors.py 2011-03-16 19:44:29 +0000
4@@ -36,7 +36,7 @@
5
6 def index(self, req):
7 """Return all flavors in brief."""
8- return dict(flavors=[dict(id=flavor['id'], name=flavor['name'])
9+ return dict(flavors=[dict(id=flavor['flavorid'], name=flavor['name'])
10 for flavor in self.detail(req)['flavors']])
11
12 def detail(self, req):
13@@ -48,6 +48,7 @@
14 """Return data about the given flavor id."""
15 ctxt = req.environ['nova.context']
16 values = db.instance_type_get_by_flavor_id(ctxt, id)
17+ values['id'] = values['flavorid']
18 return dict(flavor=values)
19 raise faults.Fault(exc.HTTPNotFound())
20
21
22=== modified file 'nova/tests/api/openstack/test_flavors.py'
23--- nova/tests/api/openstack/test_flavors.py 2011-03-08 17:18:13 +0000
24+++ nova/tests/api/openstack/test_flavors.py 2011-03-16 19:44:29 +0000
25@@ -15,6 +15,7 @@
26 # License for the specific language governing permissions and limitations
27 # under the License.
28
29+import json
30 import stubout
31 import webob
32
33@@ -50,3 +51,5 @@
34 req = webob.Request.blank('/v1.0/flavors/1')
35 res = req.get_response(fakes.wsgi_app())
36 self.assertEqual(res.status_int, 200)
37+ body = json.loads(res.body)
38+ self.assertEqual(body['flavor']['id'], 1)