added purge option and tightened up testing

This commit is contained in:
Ken Pepple
2011-02-18 17:17:47 -08:00
parent 3609f1da7e
commit 53784c1afa
4 changed files with 56 additions and 36 deletions

View File

@@ -81,6 +81,19 @@ def destroy(name):
name)
def purge(name):
"""Removes instance types / flavors from database
arguments: name"""
if name == None:
raise exception.InvalidInputException(_("No instance type specified"))
else:
try:
db.instance_type_purge(context.get_admin_context(), name)
except exception.NotFound:
raise exception.ApiError(_("Unknown instance type: %s"),
name)
def get_all_types(inactive=0):
"""Retrieves non-deleted instance_types.
Pass true as argument if you want deleted instance types returned also."""