diff options
| author | Brian Waldon <brian.waldon@rackspace.com> | 2011-03-21 18:07:19 +0000 |
|---|---|---|
| committer | Tarmac <> | 2011-03-21 18:07:19 +0000 |
| commit | fb8b0636d02e3663485d4c386a362c7d5ef35041 (patch) | |
| tree | a4ad5030c44db9074112116a1383a860a267d496 /nova/api | |
| parent | 5562c3f4b0a8e344cfd37dde19df7cb8d9fd03b2 (diff) | |
| parent | 53bc1a077746d5a72addf0f25fa8f25c8dce1990 (diff) | |
Openstack api 1.0 flavors resource now implemented to match the spec
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/openstack/flavors.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/nova/api/openstack/flavors.py b/nova/api/openstack/flavors.py index 1c440b3a9..c99b945fb 100644 --- a/nova/api/openstack/flavors.py +++ b/nova/api/openstack/flavors.py @@ -22,6 +22,7 @@ from nova import context from nova.api.openstack import faults from nova.api.openstack import common from nova.compute import instance_types +from nova.api.openstack.views import flavors as flavors_views from nova import wsgi import nova.api.openstack @@ -36,7 +37,7 @@ class Controller(wsgi.Controller): def index(self, req): """Return all flavors in brief.""" - return dict(flavors=[dict(id=flavor['flavorid'], name=flavor['name']) + return dict(flavors=[dict(id=flavor['id'], name=flavor['name']) for flavor in self.detail(req)['flavors']]) def detail(self, req): @@ -47,14 +48,18 @@ class Controller(wsgi.Controller): def show(self, req, id): """Return data about the given flavor id.""" ctxt = req.environ['nova.context'] - values = db.instance_type_get_by_flavor_id(ctxt, id) - values['id'] = values['flavorid'] + flavor = db.api.instance_type_get_by_flavor_id(ctxt, id) + values = { + "id": flavor["flavorid"], + "name": flavor["name"], + "ram": flavor["memory_mb"], + "disk": flavor["local_gb"], + } return dict(flavor=values) - raise faults.Fault(exc.HTTPNotFound()) def _all_ids(self, req): """Return the list of all flavorids.""" ctxt = req.environ['nova.context'] - inst_types = db.instance_type_get_all(ctxt) + inst_types = db.api.instance_type_get_all(ctxt) flavor_ids = [inst_types[i]['flavorid'] for i in inst_types.keys()] return sorted(flavor_ids) |
