openstack.compute.v2.flavor¶
The Flavor Class¶
The Flavor class inherits from Resource.
- class openstack.compute.v2.flavor.Flavor(_synchronized=False, connection=None, **attrs)¶
The base resource
- Parameters
_synchronized (bool) – This is not intended to be used directly. See
new()andexisting().connection (openstack.connection.Connection) – Reference to the Connection being used. Defaults to None to allow Resource objects to be used without an active Connection, such as in unit tests. Use of
self._connectionin Resource code should protect itself with a check for None.
- name¶
The name of this flavor.
- original_name¶
The name of this flavor when returned by server list/show
- description¶
The description of the flavor.
- disk¶
Size of the disk this flavor offers. Type: int
- is_public¶
Trueif this is a publicly visible flavor.Falseif this is a private image. Type: bool
- ram¶
The amount of RAM (in MB) this flavor offers. Type: int
- vcpus¶
The number of virtual CPUs this flavor offers. Type: int
- swap¶
Size of the swap partitions.
- ephemeral¶
Size of the ephemeral data disk attached to this server. Type: int
- is_disabled¶
Trueif this flavor is disabled,Falseif not. Type: bool
- rxtx_factor¶
The bandwidth scaling factor this flavor receives on the network.
- extra_specs¶
A dictionary of the flavor’s extra-specs key-and-value pairs.
- classmethod list(session, paginated=True, base_path='/flavors/detail', **params)¶
This method is a generator which yields resource objects.
This resource object list generator handles pagination and takes query params for response filtering.
- Parameters
session (
Adapter) – The session to use for making this request.paginated (bool) –
Trueif a GET to this resource returns a paginated series of responses, orFalseif a GET returns only one page of data. When paginated is False only one page of data will be returned regardless of the API’s support of pagination.base_path (str) – Base part of the URI for listing resources, if different from
base_path.allow_unknown_params (bool) –
Trueto accept, but discard unknown query parameters. This allows getting list of ‘filters’ and passing everything known to the server.Falsewill result in validation exception when unknown query parameters are passed.microversion (str) – API version to override the negotiated one.
params (dict) – These keyword arguments are passed through the
_transpose()method to find if any of them match expected query parameters to be sent in the params argument toget(). They are additionally checked against thebase_pathformat string to see if any path fragments need to be filled in by the contents of this argument. Parameters supported as filters by the server side are passed in the API call, remaining parameters are applied as filters to the retrieved results.
- Returns
A generator of
Resourceobjects.- Raises
MethodNotSupportedifResource.allow_listis not set toTrue.- Raises
InvalidResourceQueryif query contains invalid params.
- add_tenant_access(session, tenant)¶
Adds flavor access to a tenant and flavor.
- Parameters
session – The session to use for making this request.
tenant –
- Returns
None
- remove_tenant_access(session, tenant)¶
Removes flavor access to a tenant and flavor.
- Parameters
session – The session to use for making this request.
tenant –
- Returns
None
- get_access(session)¶
Lists tenants who have access to a private flavor
By default, only administrators can manage private flavor access. A private flavor has
is_publicset to false while a public flavor hasis_publicset to true.- Parameters
session – The session to use for making this request.
- Returns
List of dicts with flavor_id and tenant_id attributes
- fetch_extra_specs(session)¶
Fetch extra specs of the flavor
Starting with 2.61 extra specs are returned with the flavor details, before that a separate call is required.
- Parameters
session – The session to use for making this request.
- Returns
The updated flavor.
- create_extra_specs(session, specs)¶
Creates extra specs for a flavor.
- Parameters
session – The session to use for making this request.
specs –
- Returns
The updated flavor.
- get_extra_specs_property(session, prop)¶
Get an individual extra spec property.
- Parameters
session – The session to use for making this request.
prop – The property to fetch.
- Returns
The value of the property if it exists, else
None.
- update_extra_specs_property(session, prop, val)¶
Update an extra spec for a flavor.
- Parameters
session – The session to use for making this request.
prop – The property to update.
val – The value to update with.
- Returns
The updated value of the property.
- delete_extra_specs_property(session, prop)¶
Delete an extra spec for a flavor.
- Parameters
session – The session to use for making this request.
prop – The property to delete.
- Returns
None
The FlavorDetail Class¶
The FlavorDetail class inherits from
Flavor.
- openstack.compute.v2.flavor.FlavorDetail¶
alias of
openstack.compute.v2.flavor.Flavor