The novaclient.v2.flavors Module

The novaclient.v2.flavors Module

Flavor interface.

class novaclient.v2.flavors.Flavor(manager, info, loaded=False, resp=None)

Bases: novaclient.base.Resource

A flavor is an available hardware configuration for a server.

Populate and bind to a manager.

Parameters:
  • manager – BaseManager object
  • info – dictionary representing resource attributes
  • loaded – prevent lazy-loading if set to True
  • resp – Response or list of Response objects
HUMAN_ID = True
delete()

Delete this flavor.

Returns:An instance of novaclient.base.TupleWithMeta
ephemeral

Provide a user-friendly accessor to OS-FLV-EXT-DATA:ephemeral.

get_keys()

Get extra specs from a flavor.

Returns:An instance of novaclient.base.DictWithMeta
is_public

Provide a user-friendly accessor to os-flavor-access:is_public.

set_keys(metadata)

Set extra specs on a flavor.

Parameters:metadata – A dict of key/value pairs to be set
unset_keys(keys)

Unset extra specs on a flavor.

Parameters:keys – A list of keys to be unset
Returns:An instance of novaclient.base.TupleWithMeta
update(obj, *args, **kwargs)

Update the description for this flavor.

Parameters:description – The description to set on the flavor.
Returns:Flavor
class novaclient.v2.flavors.FlavorManager(api)

Bases: novaclient.base.ManagerWithFind

Manage Flavor resources.

create(name, ram, vcpus, disk, flavorid='auto', ephemeral=0, swap=0, rxtx_factor=1.0, is_public=True, description=None)

Create a flavor.

Parameters:
  • name – Descriptive name of the flavor
  • ram – Memory in MB for the flavor
  • vcpus – Number of VCPUs for the flavor
  • disk – Size of local disk in GB
  • flavorid – ID for the flavor (optional). You can use the reserved value "auto" to have Nova generate a UUID for the flavor in cases where you cannot simply pass None.
  • ephemeral – Ephemeral disk space in GB.
  • swap – Swap space in MB
  • rxtx_factor – RX/TX factor
  • is_public – Whether or not the flavor is public.
  • description – A free form description of the flavor. Limited to 65535 characters in length. Only printable characters are allowed. (Available starting with microversion 2.55)
Returns:

Flavor

delete(flavor)

Delete a specific flavor.

Parameters:flavor – The ID of the Flavor to get.
Returns:An instance of novaclient.base.TupleWithMeta
get(flavor)

Get a specific flavor.

Parameters:flavor – The ID of the Flavor to get.
Returns:Flavor
is_alphanum_id_allowed = True
list(detailed=True, is_public=True, marker=None, min_disk=None, min_ram=None, limit=None, sort_key=None, sort_dir=None)

Get a list of all flavors.

Parameters:
  • detailed – Whether flavor needs to be return with details (optional).
  • is_public – Filter flavors with provided access type (optional). None means give all flavors and only admin has query access to all flavor types.
  • marker – Begin returning flavors that appear later in the flavor list than that represented by this flavor id (optional).
  • min_disk – Filters the flavors by a minimum disk space, in GiB.
  • min_ram – Filters the flavors by a minimum RAM, in MB.
  • limit – maximum number of flavors to return (optional).
  • sort_key – Flavors list sort key (optional).
  • sort_dir – Flavors list sort direction (optional).
Returns:

list of Flavor.

resource_class

alias of Flavor

update(obj, *args, **kwargs)

Update the description of the flavor.

Parameters:
  • flavor – The Flavor (or its ID) to update.
  • description – The description to set on the flavor.
Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.