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: | Number of rows archived. |
---|
Move up to max_rows rows from one tables to the corresponding shadow table. The context argument is only used for the decorator.
Returns: | number of rows archived |
---|
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 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.
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 the 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 = {
| 'tag': [some-tag, some-another-tag],
| 'tag-any: [some-any-tag, some-another-any-tag]
| }
Create a new group.
Delete an group.
Get a specific group by uuid.
Get all groups.
Get all groups.
Update the attributes of an 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
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.
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.