Adds disabled field for instance-types.
The `disabled` field is intended to be used when phasing out instance-types. In this case, a delete wouldn't work because the instance-type needs to still be available for live instances using that type, but we don't want to allow *new* instances created from that type. In addition, we don't want to list hidden instance-types for regular users, but we *do* want to list them for admin-users to ensure they have a complete view of what's going on in the system. Once all references to the phased-out instance-type have been dropped, it would be safe to mark the instance-type as `deleted=True`. Change-Id: I2af1c027f4d8114aee31353007dfdd3d0bb679ed
This commit is contained in:
@@ -97,14 +97,15 @@ def destroy(name):
|
||||
raise exception.InstanceTypeNotFoundByName(instance_type_name=name)
|
||||
|
||||
|
||||
def get_all_types(inactive=0, filters=None):
|
||||
def get_all_types(inactive=False, filters=None):
|
||||
"""Get all non-deleted instance_types.
|
||||
|
||||
Pass true as argument if you want deleted instance types returned also.
|
||||
|
||||
"""
|
||||
ctxt = context.get_admin_context()
|
||||
inst_types = db.instance_type_get_all(ctxt, inactive, filters)
|
||||
inst_types = db.instance_type_get_all(
|
||||
ctxt, inactive=inactive, filters=filters)
|
||||
|
||||
inst_type_dict = {}
|
||||
for inst_type in inst_types:
|
||||
inst_type_dict[inst_type['name']] = inst_type
|
||||
|
||||
Reference in New Issue
Block a user