Add an API extension for creating+deleting flavors

This extension is a step towards deprecating openstackx for horizon.
Most of the extension code is based on the equivalent in openstackx.

v2:
    s/lifecycle/manage/ for all bits
    Address Pádraig style issues
    Drop purge API option
    Adjust now inaccurate comment in DB api
    Make extension admin_only
    Extend existing /flavors namespace rather than os-flavor-lifecycle
    Only allow API access from admin user

v3:
    Some pep8 fixes

v4:
    Adjust to root_gb, ephemeral_gb changes
    Drop admin_only (it's on the way out AIUI)

Change-Id: I3fdfccdd8e7337e1759f5875c3b15fa9954371ef
This commit is contained in:
Cole Robinson
2012-01-19 18:39:11 -05:00
parent fefb88877c
commit 35b3c08a46
6 changed files with 239 additions and 7 deletions

View File

@@ -30,9 +30,15 @@ FLAGS = flags.FLAGS
LOG = logging.getLogger('nova.instance_types')
def create(name, memory, vcpus, root_gb, ephemeral_gb, flavorid, swap=0,
rxtx_factor=1):
def create(name, memory, vcpus, root_gb, ephemeral_gb, flavorid, swap=None,
rxtx_factor=None):
"""Creates instance types."""
if swap is None:
swap = 0
if rxtx_factor is None:
rxtx_factor = 1
kwargs = {
'memory_mb': memory,
'vcpus': vcpus,