Implement project specific flavors API

blueprint project-specific-flavors

This change implements API extension to manage project specific flavor
types, so that non-public flavor type can only see by projects with
access rights.

Change-Id: Ie2d2c605065b0c76897f843a4548a0c984a05f1a
This commit is contained in:
unicell
2012-08-13 20:19:54 +08:00
parent 01aca07d2a
commit eda8349d3d
2 changed files with 9 additions and 4 deletions

View File

@@ -828,11 +828,12 @@ class InstanceTypeCommands(object):
def _print_instance_types(self, name, val):
deleted = ('', ', inactive')[val["deleted"] == 1]
is_public = ('private', 'public')[val["is_public"] == 1]
print ("%s: Memory: %sMB, VCPUS: %s, Root: %sGB, Ephemeral: %sGb, "
"FlavorID: %s, Swap: %sMB, RXTX Factor: %s, ExtraSpecs %s") % (
"FlavorID: %s, Swap: %sMB, RXTX Factor: %s, %s, ExtraSpecs %s") % (
name, val["memory_mb"], val["vcpus"], val["root_gb"],
val["ephemeral_gb"], val["flavorid"], val["swap"],
val["rxtx_factor"], val["extra_specs"])
val["rxtx_factor"], is_public, val["extra_specs"])
@args('--name', dest='name', metavar='<name>',
help='Name of instance type/flavor')
@@ -848,12 +849,15 @@ class InstanceTypeCommands(object):
@args('--swap', dest='swap', metavar='<swap>', help='Swap')
@args('--rxtx_factor', dest='rxtx_factor', metavar='<rxtx_factor>',
help='rxtx_factor')
@args('--is_public', dest="is_public", metavar='<is_public>',
help='Make flavor accessible to the public')
def create(self, name, memory, vcpus, root_gb, ephemeral_gb, flavorid,
swap=0, rxtx_factor=1):
swap=0, rxtx_factor=1, is_public=True):
"""Creates instance types / flavors"""
try:
instance_types.create(name, memory, vcpus, root_gb,
ephemeral_gb, flavorid, swap, rxtx_factor)
ephemeral_gb, flavorid, swap, rxtx_factor,
is_public)
except exception.InvalidInput, e:
print "Must supply valid parameters to create instance_type"
print e

View File

@@ -92,6 +92,7 @@
"compute_extension:disk_config": [],
"compute_extension:extended_server_attributes": [],
"compute_extension:extended_status": [],
"compute_extension:flavor_access": [],
"compute_extension:flavorextradata": [],
"compute_extension:flavorextraspecs": [],
"compute_extension:flavormanage": [],