Implementation of SQLAlchemy backend.
Finish an event on an instance action.
Start an event on an instance action.
Get the action by request_id and given instance.
Get all instance actions for the provided uuid.
Return rows that match host (mandatory) and metadata key (optional).
:param host matches host, and is required. :param key Matches metadata key, if not None.
Return rows that match metadata key.
:param key Matches metadata key.
Move up to max_rows rows from production tables to the corresponding shadow tables.
Returns: | dict that maps table name to number of rows archived from that table, for example: |
---|
{
'instances': 5,
'block_device_mapping': 5,
'pci_devices': 2,
}
Creates a new ComputeNode and populates the capacity fields with the most recent data.
Delete a ComputeNode record.
Compute statistics over all compute nodes.
Updates the ComputeNode record with the most recent data.
Create a database context manager object.
: param connection: The database connection string
Create ec2 compatible instance by provided uuid.
Create ec2 compatible snapshot by provided uuid.
Create ec2 compatible volume by provided uuid.
Keyword arguments: reserved – should be a boolean value(True or False), exact value will be used to filter on the fixed IP address
allocate a fixed ip out of a fixed ip network pool.
This allocates an unallocated fixed ip out of a specified network. We sort by updated_at to hand out the oldest address in the list.
Add given tenant to the flavor access list.
Get flavor access list by flavor id.
Remove given tenant from the flavor access list.
Create a new instance type. In order to pass in extra specs, the values dict should contain a ‘extra_specs’ key/value pair:
{‘extra_specs’ : {‘k1’: ‘v1’, ‘k2’: ‘v2’, ...}}
Marks specific flavor as deleted.
Returns a dict describing specific flavor.
Returns all flavors.
Returns a dict describing specific flavor_id.
Returns a dict describing specific flavor.
The backend is this module itself.
Get a database context manager object.
Parameters: | context – The request context that can contain a context manager |
---|
Get a database engine object.
Parameters: |
|
---|
Associate the given security group with the given instance.
Create a new Instance record in the database.
context - request context object values - dict containing column values.
Create a new InstanceFault.
Get all instance faults for the provided instance_uuids.
Return instances and joins that were active during window.
Return instances matching all filters sorted by the primary key.
See instance_get_all_by_filters_sort for more information.
Return instances that match all filters sorted by the given keys. Deleted instances will be returned by default, unless there’s a filter that says otherwise.
Depending on the name of a filter, matching for that filter is performed using either exact matching or as regular expression matching. Exact matching is applied for the following filters:
| ['project_id', 'user_id', 'image_ref',
| 'vm_state', 'instance_type_id', 'uuid',
| 'metadata', 'host', 'system_metadata']
A third type of filter (also using exact matching), filters based on instance metadata tags when supplied under a special key named ‘filter’:
| filters = {
| 'filter': [
| {'name': 'tag-key', 'value': '<metakey>'},
| {'name': 'tag-value', 'value': '<metaval>'},
| {'name': 'tag:<metakey>', 'value': '<metaval>'}
| ]
| }
Special keys are used to tweek the query further:
| 'changes-since' - only return instances updated after
| 'deleted' - only return (or exclude) deleted instances
| 'soft_deleted' - modify behavior of 'deleted' to either
| include or exclude instances whose
| vm_state is SOFT_DELETED.
A fourth type of filter (also using exact matching), filters based on instance tags (not metadata tags). There are two types of these tags:
Tags should be represented as list:
| filters = {
| 'tags': [some-tag, some-another-tag],
| 'tags-any: [some-any-tag, some-another-any-tag]
| }
Create a new group.
Delete a group.
Get a specific group by uuid.
Get all groups.
Get all groups.
Update the attributes of a group.
If values contains a metadata key, it updates the aggregate metadata too. Similarly for the policies and members.
Deletes an existing instance_info_cache record
Parameters: | instance_uuid – = uuid of the instance tied to the cache record |
---|
Gets an instance info cache from the table.
Parameters: | instance_uuid – = uuid of the info cache’s instance |
---|
Update an instance info cache record in the table.
Parameters: |
|
---|
Disassociate the given security group from the given instance.
Set the given properties on an instance and update it. Return a shallow copy of the original instance reference, as well as the updated one.
Parameters: |
|
---|
If “expected_task_state” exists in values, the update can only happen when the task state before update matches expected_task_state. Otherwise a UnexpectedTaskStateError is thrown.
Returns: | a tuple of the form (old_instance_ref, new_instance_ref) |
---|
Raises NotFound if instance does not exist.
Query helper that accounts for context’s read_deleted field.
Parameters: |
|
---|
Associate a project with a network.
called by project_get_networks under certain conditions and network manager add_network_to_project()
only associate if the project doesn’t already have a network or if force is True
force solves race condition where a fresh project has multiple instance builds simultaneously picked up by multiple network hosts which attempt to associate the project with multiple networks force should only be used as a direct consequence of user request all automated requests should not use force
Decorator to use a reader db context manager.
The db context manager will be picked from the RequestContext.
Wrapped function must have a RequestContext in the arguments.
Decorator to use a reader.allow_async db context manager.
The db context manager will be picked from the RequestContext.
Wrapped function must have a RequestContext in the arguments.
Decorator to use a writer db context manager.
The db context manager will be picked from the RequestContext.
Wrapped function must have a RequestContext in the arguments.
Process the sort parameters to include default keys.
Creates a list of sort keys and a list of sort directions. Adds the default keys to the end of the list if they are not already included.
When adding the default keys to the sort keys list, the associated direction is: 1) The first element in the ‘sort_dirs’ list (if specified), else 2) ‘default_dir’ value (Note that ‘asc’ is the default value since this is the default in sqlalchemy.utils.paginate_query)
Parameters: |
|
---|---|
Returns: | list of sort keys, list of sort directions |
Raises exception.InvalidInput: | |
If more sort directions than sort keys are specified or if an invalid sort direction is specified |
Decorator to require the specified aggregate to exist.
Requires the wrapped function to use context and aggregate_id as their first two arguments.
Decorator to require any user or admin context.
This does no authorization for user or project access matching, see nova.context.authorize_project_context() and nova.context.authorize_user_context().
The first argument to the wrapped function must be the context.
Decorator to require the specified instance to exist.
Requires the wrapped function to use context and instance_uuid as their first two arguments.
Create local s3 image represented by provided uuid.
Find local s3 image represented by the provided id.
Find local s3 image represented by the provided uuid.
Ensure default security group exists for a project_id.
Decorator to select synchronous or asynchronous reader mode.
The kwarg argument ‘use_slave’ defines reader mode. Asynchronous reader will be used if ‘use_slave’ is True and synchronous reader otherwise. If ‘use_slave’ is not specified default value ‘False’ will be used.
Wrapped function must have a context in the arguments.
Create a new virtual interface record in the database.
Parameters: | values – = dict containing column values |
---|
Delete virtual interface records that are associated with the instance given by instance_id.
Parameters: | instance_uuid – = uuid of instance |
---|
Gets a virtual interface from the table.
Parameters: | vif_id – = id of the virtual interface |
---|
Get all vifs.
Gets a virtual interface from the table.
Parameters: | address – = the address of the interface you’re looking to get |
---|
Gets all virtual interfaces for instance.
Parameters: | instance_uuid – = uuid of the instance to retrieve vifs for |
---|
Gets virtual interface for instance that’s associated with network.
Gets a virtual interface from the table.
Parameters: | vif_uuid – the uuid of the interface you’re looking to get |
---|
Return volumes usage that have been updated after a specified time.