diff options
| author | Salvatore Orlando <salvatore.orlando@eu.citrix.com> | 2011-03-22 09:54:56 +0000 |
|---|---|---|
| committer | Salvatore Orlando <salvatore.orlando@eu.citrix.com> | 2011-03-22 09:54:56 +0000 |
| commit | 24568d8f9a78a57d483e23e1ff8a9c26472ce44b (patch) | |
| tree | a5ef9e3ca7e7f1af95393b57e9aa0550aa138e46 /nova/api | |
| parent | b390c93917d060ebd6072ad58337c31c5e57da57 (diff) | |
| parent | e40d692c55a02fa686e83bd87eca29a3cfa3d15e (diff) | |
Merge trunk
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) |
