Associate flavor types with datastore versions
This feature provides the ability to associate flavor types with datastore versions.The trove-mange util enables adding/deleting this information.The trove-client has been changed to include a new api call: /{tenant_id}/datastores/{datastore}/versions/{version}/flavors. This call will return all nova flavors if no entries are found for the said datastore-version in datastore_version_metadata, otherwise only the entries found are returned. Change-Id: I89fc2db0078d7884b7b3fa91f5daec68c0132dfb Implements: blueprint associate-flavors-datastores
This commit is contained in:
@@ -30,11 +30,20 @@ class Flavors(base.ManagerWithFind):
|
|||||||
|
|
||||||
def list(self):
|
def list(self):
|
||||||
"""Get a list of all flavors.
|
"""Get a list of all flavors.
|
||||||
|
|
||||||
:rtype: list of :class:`Flavor`.
|
:rtype: list of :class:`Flavor`.
|
||||||
"""
|
"""
|
||||||
return self._list("/flavors", "flavors")
|
return self._list("/flavors", "flavors")
|
||||||
|
|
||||||
|
def list_datastore_version_associated_flavors(self, datastore,
|
||||||
|
version_id):
|
||||||
|
"""Get a list of all flavors for the specified datastore type
|
||||||
|
and datastore version .
|
||||||
|
:rtype: list of :class:`Flavor`.
|
||||||
|
"""
|
||||||
|
return self._list("/datastores/%s/versions/%s/flavors" %
|
||||||
|
(datastore, version_id),
|
||||||
|
"flavors")
|
||||||
|
|
||||||
def get(self, flavor):
|
def get(self, flavor):
|
||||||
"""Get a specific flavor.
|
"""Get a specific flavor.
|
||||||
|
|
||||||
|
@@ -111,11 +111,23 @@ def _find_backup(cs, backup):
|
|||||||
|
|
||||||
|
|
||||||
# Flavor related calls
|
# Flavor related calls
|
||||||
|
@utils.arg('--datastore_type', metavar='<datastore_type>',
|
||||||
|
default=None,
|
||||||
|
help='Type of the datastore. For eg: mysql.')
|
||||||
|
@utils.arg("--datastore_version_id", metavar="<datastore_version_id>",
|
||||||
|
default=None, help="ID of the datastore version.")
|
||||||
@utils.service_type('database')
|
@utils.service_type('database')
|
||||||
def do_flavor_list(cs, args):
|
def do_flavor_list(cs, args):
|
||||||
"""Lists available flavors."""
|
"""Lists available flavors."""
|
||||||
flavors = cs.flavors.list()
|
if args.datastore_type and args.datastore_version_id:
|
||||||
|
flavors = cs.flavors.list_datastore_version_associated_flavors(
|
||||||
|
args.datastore_type, args.datastore_version_id)
|
||||||
|
elif not args.datastore_type and not args.datastore_version_id:
|
||||||
|
flavors = cs.flavors.list()
|
||||||
|
else:
|
||||||
|
err_msg = ("Specify both <datastore_type> and <datastore_version_id>"
|
||||||
|
" to list datastore version associated flavors.")
|
||||||
|
raise exceptions.CommandError(err_msg)
|
||||||
utils.print_list(flavors, ['id', 'name', 'ram'],
|
utils.print_list(flavors, ['id', 'name', 'ram'],
|
||||||
labels={'ram': 'RAM'})
|
labels={'ram': 'RAM'})
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user