Previous topic

The nova.db.migration Module

Next topic

The nova.db.sqlalchemy.migrate_repo.manage Module

This Page

Psst... hey. You're reading the latest content, but it might be out of sync with code. You can read Nova 2011.2 docs or all OpenStack docs too.

The nova.db.sqlalchemy.api Module

Implementation of SQLAlchemy backend.

agent_build_create(*args, **kwargs)
agent_build_destroy(*args, **kwargs)
agent_build_get_all(*args, **kwargs)
agent_build_get_by_triple(*args, **kwargs)
agent_build_update(*args, **kwargs)
aggregate_create(*args, **kwargs)
aggregate_delete(*args, **kwargs)
aggregate_get(*args, **kwargs)
aggregate_get_all(*args, **kwargs)
aggregate_get_by_host(*args, **kwargs)
aggregate_host_add(*args, **kwargs)
aggregate_host_delete(*args, **kwargs)
aggregate_host_get_all(*args, **kwargs)
aggregate_metadata_add(*args, **kwargs)
aggregate_metadata_delete(*args, **kwargs)
aggregate_metadata_get(*args, **kwargs)
aggregate_metadata_get_item(*args, **kwargs)
aggregate_update(*args, **kwargs)
auth_token_create(*args, **kwargs)
auth_token_destroy(*args, **kwargs)
auth_token_get(*args, **kwargs)
auth_token_update(*args, **kwargs)
authorize_project_context(context, project_id)

Ensures a request has permission to access the given project.

authorize_user_context(context, user_id)

Ensures a request has permission to access the given user.

block_device_mapping_create(*args, **kwargs)
block_device_mapping_destroy(*args, **kwargs)
block_device_mapping_destroy_by_instance_and_volume(*args, **kwargs)
block_device_mapping_get_all_by_instance(*args, **kwargs)
block_device_mapping_update(*args, **kwargs)
block_device_mapping_update_or_create(*args, **kwargs)
bw_usage_get_by_macs(*args, **kwargs)
bw_usage_update(*args, **kwargs)
cell_create(*args, **kwargs)
cell_delete(*args, **kwargs)
cell_get(*args, **kwargs)
cell_get_all(*args, **kwargs)
cell_update(*args, **kwargs)
certificate_create(*args, **kwargs)
certificate_get(*args, **kwargs)
certificate_get_all_by_project(*args, **kwargs)
certificate_get_all_by_user(*args, **kwargs)
certificate_get_all_by_user_and_project(*args, **kwargs)
compute_node_create(*args, **kwargs)
compute_node_get(*args, **kwargs)
compute_node_get_all(*args, **kwargs)
compute_node_get_by_host(context, host)

Get all capacity entries for the given host.

compute_node_update(*args, **kwargs)
compute_node_utilization_set(context, host, free_ram_mb=None, free_disk_gb=None, work=None, vms=None)

Like compute_node_utilization_update() modify a specific host entry. But this function will set the metrics absolutely (vs. a delta update).

compute_node_utilization_update(context, host, free_ram_mb_delta=0, free_disk_gb_delta=0, work_delta=0, vm_delta=0)

Update a specific ComputeNode entry by a series of deltas. Do this as a single atomic action and lock the row for the duration of the operation. Requires that ComputeNode record exist.

console_create(context, values)
console_delete(context, console_id)
console_get(context, console_id, instance_id=None)
console_get_all_by_instance(context, instance_id)
console_get_by_pool_instance(context, pool_id, instance_id)
console_pool_create(context, values)
console_pool_get(context, pool_id)
console_pool_get_all_by_host_type(context, host, console_type)
console_pool_get_by_host_type(context, compute_host, host, console_type)
dnsdomain_get(*args, **kwargs)
dnsdomain_list(*args, **kwargs)
dnsdomain_register_for_project(*args, **kwargs)
dnsdomain_register_for_zone(*args, **kwargs)
dnsdomain_unregister(*args, **kwargs)
exact_filter(query, model, filters, legal_keys)

Applies exact match filtering to a query.

Returns the updated query. Modifies filters argument to remove filters consumed.

Parameters:
  • query – query to apply filters to
  • model – model object the query applies to, for IN-style filtering
  • filters – dictionary of filters; values that are lists, tuples, sets, or frozensets cause an ‘IN’ test to be performed, while exact matching (‘==’ operator) is used for other values
  • legal_keys – list of keys to apply exact filtering to
fixed_ip_associate(*args, **kwargs)
fixed_ip_associate_pool(*args, **kwargs)
fixed_ip_bulk_create(*args, **kwargs)
fixed_ip_create(*args, **kwargs)
fixed_ip_disassociate(*args, **kwargs)
fixed_ip_disassociate_all_by_timeout(*args, **kwargs)
fixed_ip_get(*args, **kwargs)
fixed_ip_get_all(*args, **kwargs)
fixed_ip_get_by_address(*args, **kwargs)
fixed_ip_get_by_instance(*args, **kwargs)
fixed_ip_get_by_network_host(*args, **kwargs)
fixed_ip_get_network(*args, **kwargs)
fixed_ip_update(*args, **kwargs)
fixed_ips_by_virtual_interface(*args, **kwargs)
floating_ip_allocate_address(*args, **kwargs)
floating_ip_count_by_project(*args, **kwargs)
floating_ip_create(*args, **kwargs)
floating_ip_deallocate(*args, **kwargs)
floating_ip_destroy(*args, **kwargs)
floating_ip_disassociate(*args, **kwargs)
floating_ip_fixed_ip_associate(*args, **kwargs)
floating_ip_get(*args, **kwargs)
floating_ip_get_all(*args, **kwargs)
floating_ip_get_all_by_host(*args, **kwargs)
floating_ip_get_all_by_project(*args, **kwargs)
floating_ip_get_by_address(*args, **kwargs)
floating_ip_get_by_fixed_address(*args, **kwargs)
floating_ip_get_by_fixed_ip_id(*args, **kwargs)
floating_ip_get_pools(*args, **kwargs)
floating_ip_set_auto_assigned(*args, **kwargs)
floating_ip_update(*args, **kwargs)
instance_action_create(*args, **kwargs)
instance_add_security_group(context, instance_uuid, security_group_id)

Associate the given security group with the given instance

instance_create(*args, **kwargs)
instance_data_get_for_project(*args, **kwargs)
instance_destroy(*args, **kwargs)
instance_fault_create(context, values)

Create a new InstanceFault.

instance_fault_get_by_instance_uuids(context, instance_uuids)

Get all instance faults for the provided instance_uuids.

instance_get(*args, **kwargs)
instance_get_actions(*args, **kwargs)
instance_get_active_by_window(*args, **kwargs)
instance_get_active_by_window_joined(*args, **kwargs)
instance_get_all(*args, **kwargs)
instance_get_all_by_filters(*args, **kwargs)
instance_get_all_by_host(*args, **kwargs)
instance_get_all_by_project(*args, **kwargs)
instance_get_all_by_reservation(*args, **kwargs)
instance_get_all_hung_in_rebooting(*args, **kwargs)
instance_get_by_uuid(*args, **kwargs)
instance_get_floating_address(*args, **kwargs)
instance_get_id_to_uuid_mapping(*args, **kwargs)
instance_info_cache_create(*args, **kwargs)
instance_info_cache_delete(*args, **kwargs)
instance_info_cache_get(*args, **kwargs)
instance_info_cache_update(*args, **kwargs)
instance_metadata_delete(*args, **kwargs)
instance_metadata_get(*args, **kwargs)
instance_metadata_get_item(*args, **kwargs)
instance_metadata_update(*args, **kwargs)
instance_remove_security_group(*args, **kwargs)
instance_test_and_set(*args, **kwargs)
instance_type_create(*args, **kwargs)
instance_type_destroy(*args, **kwargs)
instance_type_extra_specs_delete(*args, **kwargs)
instance_type_extra_specs_get(*args, **kwargs)
instance_type_extra_specs_get_item(*args, **kwargs)
instance_type_extra_specs_update_or_create(*args, **kwargs)
instance_type_get(*args, **kwargs)
instance_type_get_all(*args, **kwargs)
instance_type_get_by_flavor_id(*args, **kwargs)
instance_type_get_by_name(*args, **kwargs)
instance_update(*args, **kwargs)
is_admin_context(context)

Indicates if the request context is an administrator.

is_user_context(context)

Indicates if the request context is a normal user.

iscsi_target_count_by_host(*args, **kwargs)
iscsi_target_create_safe(*args, **kwargs)
key_pair_create(*args, **kwargs)
key_pair_destroy(*args, **kwargs)
key_pair_destroy_all_by_user(*args, **kwargs)
key_pair_get(*args, **kwargs)
key_pair_get_all_by_user(*args, **kwargs)
migration_create(*args, **kwargs)
migration_get(*args, **kwargs)
migration_get_all_unconfirmed(*args, **kwargs)
migration_get_by_instance_and_status(*args, **kwargs)
migration_update(*args, **kwargs)
model_query(context, *args, **kwargs)

Query helper that accounts for context’s read_deleted field.

Parameters:
  • context – context to query under
  • session – if present, the session to use
  • read_deleted – if present, overrides context’s read_deleted field.
  • project_only – if present and context is user-type, then restrict query to match the context’s project_id.
network_associate(*args, **kwargs)
network_count(*args, **kwargs)
network_count_reserved_ips(*args, **kwargs)
network_create_safe(*args, **kwargs)
network_delete_safe(*args, **kwargs)
network_disassociate(*args, **kwargs)
network_get(*args, **kwargs)
network_get_all(*args, **kwargs)
network_get_all_by_host(*args, **kwargs)
network_get_all_by_instance(*args, **kwargs)
network_get_all_by_uuids(*args, **kwargs)
network_get_associated_fixed_ips(*args, **kwargs)
network_get_by_bridge(*args, **kwargs)
network_get_by_cidr(*args, **kwargs)
network_get_by_instance(*args, **kwargs)
network_get_by_uuid(*args, **kwargs)
network_set_host(*args, **kwargs)
network_update(*args, **kwargs)
project_add_member(context, project_id, user_id)
project_create(context, values)
project_delete(context, id)
project_get(context, id, session=None)
project_get_all(context)
project_get_by_user(context, user_id)
project_get_networks(*args, **kwargs)
project_remove_member(context, project_id, user_id)
project_update(context, project_id, values)
provider_fw_rule_create(*args, **kwargs)
provider_fw_rule_destroy(*args, **kwargs)
provider_fw_rule_get_all(*args, **kwargs)
queue_get_for(context, topic, physical_node_id)
quota_create(*args, **kwargs)
quota_destroy(*args, **kwargs)
quota_destroy_all_by_project(*args, **kwargs)
quota_get(*args, **kwargs)
quota_get_all_by_project(*args, **kwargs)
quota_update(*args, **kwargs)
require_admin_context(f)

Decorator to require admin request context.

The first argument to the wrapped function must be the context.

require_aggregate_exists(f)

Decorator to require the specified aggregate to exist.

Requires the wrapped function to use context and aggregate_id as their first two arguments.

require_context(f)

Decorator to require any user or admin context.

This does no authorization for user or project access matching, see authorize_project_context() and authorize_user_context().

The first argument to the wrapped function must be the context.

require_instance_exists(f)

Decorator to require the specified instance to exist.

Requires the wrapped function to use context and instance_id as their first two arguments.

require_volume_exists(f)

Decorator to require the specified volume to exist.

Requires the wrapped function to use context and volume_id as their first two arguments.

s3_image_create(context, image_uuid)

Create local s3 image represented by provided uuid

s3_image_get(context, image_id)

Find local s3 image represented by the provided id

s3_image_get_by_uuid(context, image_uuid)

Find local s3 image represented by the provided uuid

security_group_count_by_project(*args, **kwargs)
security_group_create(*args, **kwargs)
security_group_destroy(*args, **kwargs)
security_group_exists(*args, **kwargs)
security_group_get(*args, **kwargs)
security_group_get_all(*args, **kwargs)
security_group_get_by_instance(*args, **kwargs)
security_group_get_by_name(*args, **kwargs)
security_group_get_by_project(*args, **kwargs)
security_group_in_use(*args, **kwargs)
security_group_rule_count_by_group(*args, **kwargs)
security_group_rule_create(*args, **kwargs)
security_group_rule_destroy(*args, **kwargs)
security_group_rule_get(*args, **kwargs)
security_group_rule_get_by_security_group(*args, **kwargs)
security_group_rule_get_by_security_group_grantee(*args, **kwargs)
service_create(*args, **kwargs)
service_destroy(*args, **kwargs)
service_get(*args, **kwargs)
service_get_all(*args, **kwargs)
service_get_all_by_host(*args, **kwargs)
service_get_all_by_topic(*args, **kwargs)
service_get_all_compute_by_host(*args, **kwargs)
service_get_all_compute_sorted(*args, **kwargs)
service_get_all_volume_sorted(*args, **kwargs)
service_get_by_args(*args, **kwargs)
service_get_by_host_and_topic(*args, **kwargs)
service_update(*args, **kwargs)
sm_backend_conf_create(*args, **kwargs)
sm_backend_conf_delete(*args, **kwargs)
sm_backend_conf_get(*args, **kwargs)
sm_backend_conf_get_all(*args, **kwargs)
sm_backend_conf_get_by_sr(*args, **kwargs)
sm_backend_conf_update(*args, **kwargs)
sm_flavor_create(*args, **kwargs)
sm_flavor_delete(*args, **kwargs)
sm_flavor_get(*args, **kwargs)
sm_flavor_get_all(*args, **kwargs)
sm_flavor_update(*args, **kwargs)
sm_volume_create(context, values)
sm_volume_delete(context, volume_id)
sm_volume_get(context, volume_id)
sm_volume_get_all(context)
sm_volume_update(context, volume_id, values)
snapshot_create(*args, **kwargs)
snapshot_destroy(*args, **kwargs)
snapshot_get(*args, **kwargs)
snapshot_get_all(*args, **kwargs)
snapshot_get_all_by_project(*args, **kwargs)
snapshot_get_all_for_volume(*args, **kwargs)
snapshot_update(*args, **kwargs)
user_add_project_role(context, user_id, project_id, role)
user_add_role(context, user_id, role)
user_create(*args, **kwargs)
user_delete(*args, **kwargs)
user_get(*args, **kwargs)
user_get_all(context)
user_get_by_access_key(*args, **kwargs)
user_get_roles(context, user_id)
user_get_roles_for_project(context, user_id, project_id)
user_remove_project_role(context, user_id, project_id, role)
user_remove_role(context, user_id, role)
user_update(context, user_id, values)
virtual_interface_create(*args, **kwargs)
virtual_interface_delete(*args, **kwargs)
virtual_interface_delete_by_instance(*args, **kwargs)
virtual_interface_get(*args, **kwargs)
virtual_interface_get_all(*args, **kwargs)
virtual_interface_get_by_address(*args, **kwargs)
virtual_interface_get_by_instance(*args, **kwargs)
virtual_interface_get_by_instance_and_network(*args, **kwargs)
virtual_interface_get_by_uuid(*args, **kwargs)
volume_allocate_iscsi_target(*args, **kwargs)
volume_attached(*args, **kwargs)
volume_create(*args, **kwargs)
volume_data_get_for_project(*args, **kwargs)
volume_destroy(*args, **kwargs)
volume_detached(*args, **kwargs)
volume_get(*args, **kwargs)
volume_get_all(*args, **kwargs)
volume_get_all_by_host(*args, **kwargs)
volume_get_all_by_instance(*args, **kwargs)
volume_get_all_by_project(*args, **kwargs)
volume_get_instance(*args, **kwargs)
volume_get_iscsi_target_num(*args, **kwargs)
volume_metadata_delete(*args, **kwargs)
volume_metadata_get(*args, **kwargs)
volume_metadata_get_item(*args, **kwargs)
volume_metadata_update(*args, **kwargs)
volume_type_create(*args, **kwargs)
volume_type_destroy(*args, **kwargs)
volume_type_extra_specs_delete(*args, **kwargs)
volume_type_extra_specs_get(*args, **kwargs)
volume_type_extra_specs_get_item(*args, **kwargs)
volume_type_extra_specs_update_or_create(*args, **kwargs)
volume_type_get(*args, **kwargs)
volume_type_get_all(*args, **kwargs)
volume_type_get_by_name(*args, **kwargs)
volume_update(*args, **kwargs)