summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--nova/api/openstack/flavors.py9
-rw-r--r--nova/tests/db/fakes.py2
2 files changed, 6 insertions, 5 deletions
diff --git a/nova/api/openstack/flavors.py b/nova/api/openstack/flavors.py
index da38dd34d..3124c26b2 100644
--- a/nova/api/openstack/flavors.py
+++ b/nova/api/openstack/flavors.py
@@ -47,9 +47,10 @@ class Controller(wsgi.Controller):
def show(self, req, id):
"""Return data about the given flavor id."""
- # FIXME(kpepple) do we need admin context here ?
+ # FIXME(kpepple) do we really need admin context here ?
ctxt = context.get_admin_context()
val = db.instance_type_get_by_flavor_id(ctxt, id)
+ # FIXME(kpepple) refactor db call to return dict
v = val.values()[0]
item = dict(ram=v['memory_mb'], disk=v['local_gb'],
id=v['flavorid'], name=val.keys()[0])
@@ -58,10 +59,8 @@ class Controller(wsgi.Controller):
def _all_ids(self):
"""Return the list of all flavorids."""
- # FIXME(kpepple) do we need admin context here ?
+ # FIXME(kpepple) do we really need admin context here ?
ctxt = context.get_admin_context()
- flavor_ids = []
inst_types = db.instance_type_get_all(ctxt)
- for i in inst_types.keys():
- flavor_ids.append(inst_types[i]['flavorid'])
+ flavor_ids = [inst_types[i]['flavorid'] for i in inst_types.keys()]
return flavor_ids
diff --git a/nova/tests/db/fakes.py b/nova/tests/db/fakes.py
index 3b47fc867..859ed6edc 100644
--- a/nova/tests/db/fakes.py
+++ b/nova/tests/db/fakes.py
@@ -46,6 +46,8 @@ def stub_out_db_instance_api(stubs):
# FIXME(kpepple) for dynamic flavors
type_data = instance_types.INSTANCE_TYPES[values['instance_type']]
+ # type_data = db.instance_type_get_by_name(context,\
+ # instance_type)[instance_type]
base_options = {
'name': values['name'],