~hudson-openstack/nova/trunk

« back to all changes in this revision

Viewing changes to nova/compute/instance_types.py

  • Committer: Tarmac
  • Author(s): Rick Harris
  • Date: 2011-09-22 16:42:20 UTC
  • mfrom: (1590.1.11 flavor_min_filter)
  • Revision ID: tarmac-20110922164220-ndscikwberuj3c7f
This patch adds flavor filtering, specifically the ability to flavor on minRam, minDisk, or both, per the 1.1 OSAPI spec.

In addition, this patch refactors instance_type_get_all to return a *list* of instance_types instead of a *dict*. This makes it more consistent with the rest of the DB API.

Show diffs side-by-side

added added

removed removed

Lines of Context:
91
91
    Pass true as argument if you want deleted instance types returned also.
92
92
 
93
93
    """
94
 
    return db.instance_type_get_all(context.get_admin_context(), inactive)
95
 
 
 
94
    ctxt = context.get_admin_context()
 
95
    inst_types = db.instance_type_get_all(ctxt, inactive)
 
96
    inst_type_dict = {}
 
97
    for inst_type in inst_types:
 
98
        inst_type_dict[inst_type['name']] = inst_type
 
99
    return inst_type_dict
96
100
 
97
101
get_all_flavors = get_all_types
98
102