The Database Layer

The nova.db.api Module

Defines interface for DB access.

The underlying driver is loaded as a LazyPluggable.

Functions in this module are imported into the nova.db namespace. Call these functions from nova.db namespace, not the nova.db.api namespace.

All functions in this module return objects that implement a dictionary-like interface. Currently, many of these objects are sqlalchemy objects that implement a dictionary interface. However, a future goal is to have all of these objects be simple dictionaries.

Related Flags

db_backend:string to lookup in the list of LazyPluggable backends. sqlalchemy is the only supported backend right now.
sql_connection:string specifying the sqlalchemy connection to use, like: sqlite:///var/lib/nova/nova.sqlite.
enable_new_services:
 when adding a new service to the database, is it in the pool of available hardware (Default: True)
exception NoMoreNetworks(message=None, **kwargs)

Bases: nova.exception.NovaException

No more available networks.

exception NoMoreTargets(message=None, **kwargs)

Bases: nova.exception.NovaException

No more available targets

agent_build_create(context, values)

Create a new agent build entry.

agent_build_destroy(context, agent_update_id)

Destroy agent build entry.

agent_build_get_all(context)

Get all agent builds.

agent_build_get_by_triple(context, hypervisor, os, architecture)

Get agent build by hypervisor/OS/architecture triple.

agent_build_update(context, agent_build_id, values)

Update agent build entry.

aggregate_create(context, values, metadata=None)

Create a new aggregate with metadata.

aggregate_delete(context, aggregate_id)

Delete an aggregate.

aggregate_get(context, aggregate_id)

Get a specific aggregate by id.

aggregate_get_all(context)

Get all aggregates.

aggregate_get_by_host(context, host, key=None)

Get a list of aggregates that host belongs to

aggregate_host_add(context, aggregate_id, host)

Add host to the aggregate.

aggregate_host_delete(context, aggregate_id, host)

Delete the given host from the aggregate.

aggregate_host_get_all(context, aggregate_id)

Get hosts for the specified aggregate.

aggregate_metadata_add(context, aggregate_id, metadata, set_delete=False)

Add/update metadata. If set_delete=True, it adds only.

aggregate_metadata_delete(context, aggregate_id, key)

Delete the given metadata key.

aggregate_metadata_get(context, aggregate_id)

Get metadata for the specified aggregate.

aggregate_metadata_get_by_host(context, host, key=None)

Get metadata for all aggregates that host belongs to.

Returns a dictionary where each value is a set, this is to cover the case where there two aggregates have different values for the same key. Optional key filter

aggregate_update(context, aggregate_id, values)

Update the attributes of an aggregates. If values contains a metadata key, it updates the aggregate metadata too.

block_device_mapping_create(context, values)

Create an entry of block device mapping

block_device_mapping_destroy(context, bdm_id)

Destroy the block device mapping.

block_device_mapping_destroy_by_instance_and_device(context, instance_uuid, device_name)

Destroy the block device mapping.

block_device_mapping_destroy_by_instance_and_volume(context, instance_uuid, volume_id)

Destroy the block device mapping.

block_device_mapping_get_all_by_instance(context, instance_uuid)

Get all block device mapping belonging to an instance

block_device_mapping_update(context, bdm_id, values)

Update an entry of block device mapping

block_device_mapping_update_or_create(context, values)

Update an entry of block device mapping. If not existed, create a new entry

bw_usage_get_by_uuids(context, uuids, start_period)

Return bw usages for instance(s) in a given audit period.

bw_usage_update(context, uuid, mac, start_period, bw_in, bw_out, last_refreshed=None)

Update cached bandwidth usage for an instance’s network based on mac address. Creates new record if needed.

certificate_create(context, values)

Create a certificate from the values dictionary.

certificate_get_all_by_project(context, project_id)

Get all certificates for a project.

certificate_get_all_by_user(context, user_id)

Get all certificates for a user.

certificate_get_all_by_user_and_project(context, user_id, project_id)

Get all certificates for a user and project.

compute_node_create(context, values)

Create a computeNode from the values dictionary.

compute_node_get(context, compute_id)

Get a computeNode.

compute_node_get_all(context)

Get all computeNodes.

compute_node_get_by_host(context, host)
compute_node_search_by_hypervisor(context, hypervisor_match)

Get computeNodes given a hypervisor hostname match string.

compute_node_statistics(context)
compute_node_update(context, compute_id, values, prune_stats=False)

Set the given properties on a computeNode and update it.

Raises NotFound if computeNode does not exist.

console_create(context, values)

Create a console.

console_delete(context, console_id)

Delete a console.

console_get(context, console_id, instance_uuid=None)

Get a specific console (possibly on a given instance).

console_get_all_by_instance(context, instance_uuid)

Get consoles for a given instance.

console_get_by_pool_instance(context, pool_id, instance_uuid)

Get console entry for a given instance and pool.

console_pool_create(context, values)

Create console pool.

console_pool_get_all_by_host_type(context, host, console_type)

Fetch all pools for given proxy host and type.

console_pool_get_by_host_type(context, compute_host, proxy_host, console_type)

Fetch a console pool for a given proxy host, compute host, and type.

constraint(**conditions)

Return a constraint object suitable for use with some updates.

dnsdomain_get(context, fqdomain)

Get the db record for the specified domain.

dnsdomain_list(context)

Get a list of all zones in our database, public and private.

dnsdomain_register_for_project(context, fqdomain, project)

Associated a DNS domain with a project id

dnsdomain_register_for_zone(context, fqdomain, zone)

Associated a DNS domain with an availability zone

dnsdomain_unregister(context, fqdomain)

Purge associations for the specified DNS zone

ec2_instance_create(context, instance_ec2_id)

Create the ec2 id to instance uuid mapping on demand

ec2_snapshot_create(context, snapshot_id, forced_id=None)
ec2_volume_create(context, volume_id, forced_id=None)
equal_any(*values)

Return an equality condition object suitable for use in a constraint.

Equal_any conditions require that a model object’s attribute equal any one of the given values.

fixed_ip_associate(context, address, instance_uuid, network_id=None, reserved=False)

Associate fixed ip to instance.

Raises if fixed ip is not available.

fixed_ip_associate_pool(context, network_id, instance_uuid=None, host=None)

Find free ip in network and associate it to instance or host.

Raises if one is not available.

fixed_ip_bulk_create(context, ips)

Create a lot of fixed ips from the values dictionary.

fixed_ip_count_by_project(context, project_id, session=None)

Count fixed ips used by project.

fixed_ip_create(context, values)

Create a fixed ip from the values dictionary.

fixed_ip_disassociate(context, address)

Disassociate a fixed ip from an instance by address.

fixed_ip_disassociate_all_by_timeout(context, host, time)

Disassociate old fixed ips from host.

fixed_ip_get(context, id)

Get fixed ip by id or raise if it does not exist.

fixed_ip_get_all(context)

Get all defined fixed ips.

fixed_ip_get_by_address(context, address)

Get a fixed ip by address or raise if it does not exist.

fixed_ip_get_by_instance(context, instance_uuid)

Get fixed ips by instance or raise if none exist.

fixed_ip_get_by_network_host(context, network_uuid, host)

Get fixed ip for a host in a network.

fixed_ip_get_network(context, address)

Get a network for a fixed ip by address.

fixed_ip_update(context, address, values)

Create a fixed ip from the values dictionary.

fixed_ips_by_virtual_interface(context, vif_id)

Get fixed ips by virtual interface or raise if none exist.

floating_ip_allocate_address(context, project_id, pool)

Allocate free floating ip from specified pool and return the address.

Raises if one is not available.

floating_ip_bulk_create(context, ips)

Create a lot of floating ips from the values dictionary.

floating_ip_bulk_destroy(context, ips)

Destroy a lot of floating ips from the values dictionary.

floating_ip_count_by_project(context, project_id, session=None)

Count floating ips used by project.

floating_ip_create(context, values)

Create a floating ip from the values dictionary.

floating_ip_deallocate(context, address)

Deallocate a floating ip by address.

floating_ip_destroy(context, address)

Destroy the floating_ip or raise if it does not exist.

floating_ip_disassociate(context, address)

Disassociate a floating ip from a fixed ip by address.

Returns:the address of the previous fixed ip or None if the ip was not associated to an ip.
floating_ip_fixed_ip_associate(context, floating_address, fixed_address, host)

Associate a floating ip to a fixed_ip by address.

Returns:the address of the new fixed ip (fixed_address) or None if the ip was already associated to the fixed ip.
floating_ip_get(context, id)
floating_ip_get_all(context)

Get all floating ips.

floating_ip_get_all_by_host(context, host)

Get all floating ips by host.

floating_ip_get_all_by_project(context, project_id)

Get all floating ips by project.

floating_ip_get_by_address(context, address)

Get a floating ip by address or raise if it doesn’t exist.

floating_ip_get_by_fixed_address(context, fixed_address)

Get a floating ips by fixed address

floating_ip_get_by_fixed_ip_id(context, fixed_ip_id)

Get a floating ips by fixed address

floating_ip_get_pools(context)

Returns a list of floating ip pools

floating_ip_set_auto_assigned(context, address)

Set auto_assigned flag to floating ip

floating_ip_update(context, address, values)

Update a floating ip by address or raise if it doesn’t exist.

get_ec2_instance_id_by_uuid(context, instance_id)

Get ec2 id through uuid from instance_id_mappings table

get_ec2_snapshot_id_by_uuid(context, snapshot_id)
get_ec2_volume_id_by_uuid(context, volume_id)
get_instance_uuid_by_ec2_id(context, ec2_id)

Get uuid through ec2 id from instance_id_mappings table

get_snapshot_uuid_by_ec2_id(context, ec2_id)
get_volume_uuid_by_ec2_id(context, ec2_id)
instance_add_security_group(context, instance_id, security_group_id)

Associate the given security group with the given instance.

instance_create(context, values)

Create an instance from the values dictionary.

instance_data_get_for_project(context, project_id, session=None)

Get (instance_count, total_cores, total_ram) for project.

instance_destroy(context, instance_uuid, constraint=None)

Destroy the instance or raise if it does not exist.

instance_fault_create(context, values)

Create a new Instance Fault.

instance_fault_get_by_instance_uuids(context, instance_uuids)

Get all instance faults for the provided instance_uuids.

instance_get(context, instance_id)

Get an instance or raise if it does not exist.

instance_get_active_by_window(context, begin, end=None, project_id=None, host=None)

Get instances active during a certain time window.

Specifying a project_id will filter for a certain project. Specifying a host will filter for instances on a given compute host.

instance_get_active_by_window_joined(context, begin, end=None, project_id=None, host=None)

Get instances and joins active during a certain time window.

Specifying a project_id will filter for a certain project. Specifying a host will filter for instances on a given compute host.

instance_get_all(context, columns_to_join=None)

Get all instances.

instance_get_all_by_filters(context, filters, sort_key='created_at', sort_dir='desc', limit=None, marker=None)

Get all instances that match all filters.

instance_get_all_by_host(context, host)

Get all instances belonging to a host.

instance_get_all_by_host_and_not_type(context, host, type_id=None)

Get all instances belonging to a host with a different type_id.

instance_get_all_by_project(context, project_id)

Get all instances belonging to a project.

instance_get_all_by_reservation(context, reservation_id)

Get all instances belonging to a reservation.

instance_get_all_hung_in_rebooting(context, reboot_window)

Get all instances stuck in a rebooting state.

instance_get_by_uuid(context, uuid)

Get an instance or raise if it does not exist.

instance_get_floating_address(context, instance_id)

Get the first floating ip address of an instance.

instance_info_cache_create(context, values)

Create a new instance cache record in the table.

Parameters:
  • context – = request context object
  • values – = dict containing column values
instance_info_cache_delete(context, instance_uuid)

Deletes an existing instance_info_cache record

Parameters:instance_uuid – = uuid of the instance tied to the cache record
instance_info_cache_get(context, instance_uuid)

Gets an instance info cache from the table.

Parameters:instance_uuid – = uuid of the info cache’s instance
instance_info_cache_update(context, instance_uuid, values)

Update an instance info cache record in the table.

Parameters:
  • instance_uuid – = uuid of info cache’s instance
  • values – = dict containing column values to update
instance_metadata_delete(context, instance_uuid, key)

Delete the given metadata item.

instance_metadata_get(context, instance_uuid)

Get all metadata for an instance.

instance_metadata_update(context, instance_uuid, metadata, delete)

Update metadata if it exists, otherwise create it.

instance_remove_security_group(context, instance_id, security_group_id)

Disassociate the given security group from the given instance.

instance_system_metadata_delete(context, instance_uuid, key)

Delete the given system metadata item.

instance_system_metadata_get(context, instance_uuid)

Get all system metadata for an instance.

instance_system_metadata_update(context, instance_uuid, metadata, delete)

Update metadata if it exists, otherwise create it.

instance_test_and_set(context, instance_uuid, attr, ok_states, new_state)

Atomically check if an instance is in a valid state, and if it is, set the instance into a new state.

instance_type_access_add(context, flavor_id, project_id)

Add flavor access for project.

instance_type_access_get_by_flavor_id(context, flavor_id)

Get flavor access by flavor id.

instance_type_access_remove(context, flavor_id, project_id)

Remove flavor access for project.

instance_type_create(context, values)

Create a new instance type.

instance_type_destroy(context, name)

Delete an instance type.

instance_type_extra_specs_delete(context, flavor_id, key)

Delete the given extra specs item.

instance_type_extra_specs_get(context, flavor_id)

Get all extra specs for an instance type.

instance_type_extra_specs_update_or_create(context, flavor_id, extra_specs)

Create or update instance type extra specs. This adds or modifies the key/value pairs specified in the extra specs dict argument

instance_type_get(context, id)

Get instance type by id.

instance_type_get_all(context, inactive=False, filters=None)

Get all instance types.

instance_type_get_by_flavor_id(context, id)

Get instance type by flavor id.

instance_type_get_by_name(context, name)

Get instance type by name.

instance_update(context, instance_uuid, values)

Set the given properties on an instance and update it.

Raises NotFound if instance does not exist.

instance_update_and_get_original(context, instance_uuid, values)

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:
  • context – = request context object
  • instance_id – = instance id or uuid
  • values – = dict containing column values
Returns:

a tuple of the form (old_instance_ref, new_instance_ref)

Raises NotFound if instance does not exist.

iscsi_target_count_by_host(context, host)

Return count of export devices.

iscsi_target_create_safe(context, values)

Create an iscsi_target from the values dictionary.

The device is not returned. If the create violates the unique constraints because the iscsi_target and host already exist, no exception is raised.

key_pair_count_by_user(context, user_id)

Count number of key pairs for the given user ID.

key_pair_create(context, values)

Create a key_pair from the values dictionary.

key_pair_destroy(context, user_id, name)

Destroy the key_pair or raise if it does not exist.

key_pair_destroy_all_by_user(context, user_id)

Destroy all key_pairs by user.

key_pair_get(context, user_id, name)

Get a key_pair or raise if it does not exist.

key_pair_get_all_by_user(context, user_id)

Get all key_pairs by user.

migration_create(context, values)

Create a migration record.

migration_get(context, migration_id)

Finds a migration by the id.

migration_get_by_instance_and_status(context, instance_uuid, status)

Finds a migration by the instance uuid its migrating.

migration_get_unconfirmed_by_dest_compute(context, confirm_window, dest_compute)

Finds all unconfirmed migrations within the confirmation window for a specific destination compute host.

migration_update(context, id, values)

Update a migration instance.

network_associate(context, project_id, network_id=None, force=False)

Associate a free network to a project.

network_count(context)

Return the number of networks.

network_count_reserved_ips(context, network_id)

Return the number of reserved ips in the network.

network_create_fixed_ips(context, network_id, num_vpn_clients)

Create the ips for the network, reserving sepecified ips.

network_create_safe(context, values)

Create a network from the values dict.

The network is only returned if the create succeeds. If the create violates constraints because the network already exists, no exception is raised.

network_delete_safe(context, network_id)

Delete network with key network_id.

This method assumes that the network is not associated with any project

network_disassociate(context, network_id)

Disassociate the network from project or raise if it does not exist.

network_get(context, network_id, project_only='allow_none')

Get a network or raise if it does not exist.

network_get_all(context)

Return all defined networks.

network_get_all_by_host(context, host)

All networks for which the given host is the network host.

network_get_all_by_instance(context, instance_id)

Get all networks by instance id or raise if none exist.

network_get_all_by_uuids(context, network_uuids, project_only='allow_none')

Return networks by ids.

network_get_associated_fixed_ips(context, network_id, host=None)

Get all network’s ips that have been associated.

network_get_by_bridge(context, bridge)

Get a network by bridge or raise if it does not exist.

network_get_by_cidr(context, cidr)

Get a network by cidr or raise if it does not exist

network_get_by_instance(context, instance_id)

Get a network by instance id or raise if it does not exist.

network_get_by_uuid(context, uuid)

Get a network by uuid or raise if it does not exist.

network_get_index(context, network_id)

Get non-conflicting index for network.

network_set_cidr(context, network_id, cidr)

Set the Classless Inner Domain Routing for the network.

network_set_host(context, network_id, host_id)

Safely set the host for network.

network_update(context, network_id, values)

Set the given properties on a network and update it.

Raises NotFound if network does not exist.

not_equal(*values)

Return an inequality condition object suitable for use in a constraint.

Not_equal conditions require that a model object’s attribute differs from all of the given values.

project_get_networks(context, project_id, associate=True)

Return the network associated with the project.

If associate is true, it will attempt to associate a new network if one is not found, otherwise it returns None.

provider_fw_rule_create(context, rule)

Add a firewall rule at the provider level (all hosts & instances).

provider_fw_rule_destroy(context, rule_id)

Delete a provider firewall rule from the database.

provider_fw_rule_get_all(context)

Get all provider-level firewall rules.

quota_class_create(context, class_name, resource, limit)

Create a quota class for the given name and resource.

quota_class_destroy(context, class_name, resource)

Destroy the quota class or raise if it does not exist.

quota_class_destroy_all_by_name(context, class_name)

Destroy all quotas associated with a given quota class.

quota_class_get(context, class_name, resource)

Retrieve a quota class or raise if it does not exist.

quota_class_get_all_by_name(context, class_name)

Retrieve all quotas associated with a given quota class.

quota_class_update(context, class_name, resource, limit)

Update a quota class or raise if it does not exist.

quota_create(context, project_id, resource, limit)

Create a quota for the given project and resource.

quota_destroy(context, project_id, resource)

Destroy the quota or raise if it does not exist.

quota_destroy_all_by_project(context, project_id)

Destroy all quotas associated with a given project.

quota_get(context, project_id, resource)

Retrieve a quota or raise if it does not exist.

quota_get_all_by_project(context, project_id)

Retrieve all quotas associated with a given project.

quota_reserve(context, resources, quotas, deltas, expire, until_refresh, max_age, project_id=None)

Check quotas and create appropriate reservations.

quota_update(context, project_id, resource, limit)

Update a quota or raise if it does not exist.

quota_usage_create(context, project_id, resource, in_use, reserved, until_refresh)

Create a quota usage for the given project and resource.

quota_usage_destroy(context, project_id, resource)

Destroy the quota usage or raise if it does not exist.

quota_usage_get(context, project_id, resource)

Retrieve a quota usage or raise if it does not exist.

quota_usage_get_all_by_project(context, project_id)

Retrieve all usage associated with a given resource.

quota_usage_update(context, project_id, resource, in_use, reserved, until_refresh)

Update a quota usage or raise if it does not exist.

reservation_commit(context, reservations, project_id=None)

Commit quota reservations.

reservation_create(context, uuid, usage, project_id, resource, delta, expire)

Create a reservation for the given project and resource.

reservation_destroy(context, uuid)

Destroy the reservation or raise if it does not exist.

reservation_expire(context)

Roll back any expired reservations.

reservation_get(context, uuid)

Retrieve a reservation or raise if it does not exist.

reservation_get_all_by_project(context, project_id)

Retrieve all reservations associated with a given project.

reservation_rollback(context, reservations, project_id=None)

Roll back quota reservations.

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(context, project_id, session=None)

Count number of security groups in a project.

security_group_create(context, values)

Create a new security group.

security_group_destroy(context, security_group_id)

Deletes a security group.

security_group_ensure_default(context)

Ensure default security group exists for a project_id.

Returns a tuple with the first element being a bool indicating if the default security group previously existed. Second element is the dict used to create the default security group.

security_group_exists(context, project_id, group_name)

Indicates if a group name exists in a project.

security_group_get(context, security_group_id)

Get security group by its id.

security_group_get_all(context)

Get all security groups.

security_group_get_by_instance(context, instance_id)

Get security groups to which the instance is assigned.

security_group_get_by_name(context, project_id, group_name)

Returns a security group with the specified name from a project.

security_group_get_by_project(context, project_id)

Get all security groups belonging to a project.

security_group_in_use(context, group_id)

Indicates if a security group is currently in use.

security_group_rule_count_by_group(context, security_group_id)

Count rules in a given security group.

security_group_rule_create(context, values)

Create a new security group.

security_group_rule_destroy(context, security_group_rule_id)

Deletes a security group rule.

security_group_rule_get(context, security_group_rule_id)

Gets a security group rule.

security_group_rule_get_by_security_group(context, security_group_id)

Get all rules for a given security group.

security_group_rule_get_by_security_group_grantee(context, security_group_id)

Get all rules that grant access to the given security group.

service_create(context, values)

Create a service from the values dictionary.

service_destroy(context, instance_id)

Destroy the service or raise if it does not exist.

service_get(context, service_id)

Get a service or raise if it does not exist.

service_get_all(context, disabled=None)

Get all services.

service_get_all_by_host(context, host)

Get all services for a given host.

service_get_all_by_topic(context, topic)

Get all services for a given topic.

service_get_all_compute_by_host(context, host)

Get all compute services for a given host.

service_get_all_compute_sorted(context)

Get all compute services sorted by instance count.

Returns:a list of (Service, instance_count) tuples.
service_get_all_volume_sorted(context)

Get all volume services sorted by volume count.

Returns:a list of (Service, volume_count) tuples.
service_get_by_args(context, host, binary)

Get the state of a service by node name and binary.

service_get_by_host_and_topic(context, host, topic)

Get a service by host it’s on and topic it listens to.

service_update(context, service_id, values)

Set the given properties on a service and update it.

Raises NotFound if service does not exist.

sm_backend_conf_create(context, values)

Create a new SM Backend Config entry.

sm_backend_conf_delete(context, sm_backend_conf_id)

Delete a SM Backend Config.

sm_backend_conf_get(context, sm_backend_conf_id)

Get a specific SM Backend Config.

sm_backend_conf_get_all(context)

Get all SM Backend Configs.

sm_backend_conf_get_by_sr(context, sr_uuid)

Get a specific SM Backend Config.

sm_backend_conf_update(context, sm_backend_conf_id, values)

Update a SM Backend Config entry.

sm_flavor_create(context, values)

Create a new SM Flavor entry.

sm_flavor_delete(context, sm_flavor_id)

Delete a SM Flavor.

sm_flavor_get(context, sm_flavor_id)

Get a specific SM Flavor.

sm_flavor_get_all(context)

Get all SM Flavors.

sm_flavor_get_by_label(context, sm_flavor_label)

Get a specific SM Flavor given label.

sm_flavor_update(context, sm_flavor_id, values)

Update a SM Flavor entry.

sm_volume_create(context, values)

Create a new child Zone entry.

sm_volume_delete(context, volume_id)

Delete a child Zone.

sm_volume_get(context, volume_id)

Get a specific child Zone.

sm_volume_get_all(context)

Get all child Zones.

sm_volume_update(context, volume_id, values)

Update a child Zone entry.

snapshot_create(context, values)

Create a snapshot from the values dictionary.

snapshot_destroy(context, snapshot_id)

Destroy the snapshot or raise if it does not exist.

snapshot_get(context, snapshot_id)

Get a snapshot or raise if it does not exist.

snapshot_get_all(context)

Get all snapshots.

snapshot_get_all_by_project(context, project_id)

Get all snapshots belonging to a project.

snapshot_get_all_for_volume(context, volume_id)

Get all snapshots for a volume.

snapshot_update(context, snapshot_id, values)

Set the given properties on a snapshot and update it.

Raises NotFound if snapshot does not exist.

task_log_begin_task(context, task_name, period_beginning, period_ending, host, task_items=None, message=None, session=None)

Mark a task as started for a given host/time period

task_log_end_task(context, task_name, period_beginning, period_ending, host, errors, message=None, session=None)

Mark a task as complete for a given host/time period

task_log_get(context, task_name, period_beginning, period_ending, host, state=None, session=None)
task_log_get_all(context, task_name, period_beginning, period_ending, host=None, state=None, session=None)
virtual_interface_create(context, values)

Create a virtual interface record in the database.

virtual_interface_delete(context, vif_id)

Delete virtual interface record from the database.

virtual_interface_delete_by_instance(context, instance_id)

Delete virtual interface records associated with instance.

virtual_interface_get(context, vif_id)

Gets a virtual interface from the table,

virtual_interface_get_all(context)

Gets all virtual interfaces from the table

virtual_interface_get_by_address(context, address)

Gets a virtual interface from the table filtering on address.

virtual_interface_get_by_instance(context, instance_id)

Gets all virtual_interfaces for instance.

virtual_interface_get_by_instance_and_network(context, instance_id, network_id)

Gets all virtual interfaces for instance.

virtual_interface_get_by_uuid(context, vif_uuid)

Gets a virtual interface from the table filtering on vif uuid.

volume_allocate_iscsi_target(context, volume_id, host)

Atomically allocate a free iscsi_target from the pool.

volume_attached(context, volume_id, instance_id, mountpoint)

Ensure that a volume is set as attached.

volume_create(context, values)

Create a volume from the values dictionary.

volume_data_get_for_project(context, project_id, session=None)

Get (volume_count, gigabytes) for project.

volume_destroy(context, volume_id)

Destroy the volume or raise if it does not exist.

volume_detached(context, volume_id)

Ensure that a volume is set as detached.

volume_get(context, volume_id)

Get a volume or raise if it does not exist.

volume_get_active_by_window(context, begin, end=None, project_id=None)

Get all the volumes inside the window.

Specifying a project_id will filter for a certain project.

volume_get_all(context)

Get all volumes.

volume_get_all_by_host(context, host)

Get all volumes belonging to a host.

volume_get_all_by_instance_uuid(context, instance_uuid)

Get all volumes belonging to an instance.

volume_get_all_by_project(context, project_id)

Get all volumes belonging to a project.

volume_get_by_ec2_id(context, ec2_id)

Get a volume by ec2 id.

volume_get_iscsi_target_num(context, volume_id)

Get the target num (tid) allocated to the volume.

volume_metadata_delete(context, volume_id, key)

Delete the given metadata item.

volume_metadata_get(context, volume_id)

Get all metadata for a volume.

volume_metadata_update(context, volume_id, metadata, delete)

Update metadata if it exists, otherwise create it.

volume_type_create(context, values)

Create a new volume type.

volume_type_destroy(context, name)

Delete a volume type.

volume_type_extra_specs_delete(context, volume_type_id, key)

Delete the given extra specs item.

volume_type_extra_specs_get(context, volume_type_id)

Get all extra specs for a volume type.

volume_type_extra_specs_update_or_create(context, volume_type_id, extra_specs)

Create or update volume type extra specs. This adds or modifies the key/value pairs specified in the extra specs dict argument

volume_type_get(context, id)

Get volume type by id.

volume_type_get_all(context, inactive=False)

Get all volume types.

volume_type_get_by_name(context, name)

Get volume type by name.

volume_update(context, volume_id, values)

Set the given properties on a volume and update it.

Raises NotFound if volume does not exist.

The Sqlalchemy Driver

The nova.db.sqlalchemy.api Module

The nova.db.sqlalchemy.models Module

SQLAlchemy models for nova data.

class AgentBuild(**kwargs)

Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase

Represents an agent build.

AgentBuild.architecture
AgentBuild.created_at
AgentBuild.deleted
AgentBuild.deleted_at
AgentBuild.hypervisor
AgentBuild.id
AgentBuild.md5hash
AgentBuild.os
AgentBuild.updated_at
AgentBuild.url
AgentBuild.version
class Aggregate(**kwargs)

Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase

Represents a cluster of hosts that exists in this zone.

Aggregate.availability_zone
Aggregate.created_at
Aggregate.deleted
Aggregate.deleted_at
Aggregate.hosts
Aggregate.id
Aggregate.metadetails
Aggregate.name
Aggregate.updated_at
class AggregateHost(**kwargs)

Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase

Represents a host that is member of an aggregate.

AggregateHost.aggregate_id
AggregateHost.created_at
AggregateHost.deleted
AggregateHost.deleted_at
AggregateHost.host
AggregateHost.id
AggregateHost.updated_at
class AggregateMetadata(**kwargs)

Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase

Represents a metadata key/value pair for an aggregate.

AggregateMetadata.aggregate_id
AggregateMetadata.created_at
AggregateMetadata.deleted
AggregateMetadata.deleted_at
AggregateMetadata.id
AggregateMetadata.key
AggregateMetadata.updated_at
AggregateMetadata.value
class BandwidthUsage(**kwargs)

Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase

Cache for instance bandwidth usage data pulled from the hypervisor

BandwidthUsage.bw_in
BandwidthUsage.bw_out
BandwidthUsage.created_at
BandwidthUsage.deleted
BandwidthUsage.deleted_at
BandwidthUsage.id
BandwidthUsage.last_refreshed
BandwidthUsage.mac
BandwidthUsage.start_period
BandwidthUsage.updated_at
BandwidthUsage.uuid
class BlockDeviceMapping(**kwargs)

Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase

Represents block device mapping that is defined by EC2

BlockDeviceMapping.connection_info
BlockDeviceMapping.created_at
BlockDeviceMapping.delete_on_termination
BlockDeviceMapping.deleted
BlockDeviceMapping.deleted_at
BlockDeviceMapping.device_name
BlockDeviceMapping.id
BlockDeviceMapping.instance
BlockDeviceMapping.instance_uuid
BlockDeviceMapping.no_device
BlockDeviceMapping.snapshot_id
BlockDeviceMapping.updated_at
BlockDeviceMapping.virtual_name
BlockDeviceMapping.volume_id
BlockDeviceMapping.volume_size
class Certificate(**kwargs)

Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase

Represents a x509 certificate

Certificate.created_at
Certificate.deleted
Certificate.deleted_at
Certificate.file_name
Certificate.id
Certificate.project_id
Certificate.updated_at
Certificate.user_id
class ComputeNode(**kwargs)

Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase

Represents a running compute service on a host.

ComputeNode.cpu_info
ComputeNode.created_at
ComputeNode.current_workload
ComputeNode.deleted
ComputeNode.deleted_at
ComputeNode.disk_available_least
ComputeNode.free_disk_gb
ComputeNode.free_ram_mb
ComputeNode.hypervisor_hostname
ComputeNode.hypervisor_type
ComputeNode.hypervisor_version
ComputeNode.id
ComputeNode.local_gb
ComputeNode.local_gb_used
ComputeNode.memory_mb
ComputeNode.memory_mb_used
ComputeNode.running_vms
ComputeNode.service
ComputeNode.service_id
ComputeNode.updated_at
ComputeNode.vcpus
ComputeNode.vcpus_used
class ComputeNodeStat(**kwargs)

Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase

Stats related to the current workload of a compute host that are intended to aid in making scheduler decisions.

ComputeNodeStat.compute_node_id
ComputeNodeStat.created_at
ComputeNodeStat.deleted
ComputeNodeStat.deleted_at
ComputeNodeStat.id
ComputeNodeStat.key
ComputeNodeStat.stats
ComputeNodeStat.updated_at
ComputeNodeStat.value
class Console(**kwargs)

Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase

Represents a console session for an instance.

Console.created_at
Console.deleted
Console.deleted_at
Console.id
Console.instance_name
Console.instance_uuid
Console.password
Console.pool
Console.pool_id
Console.port
Console.updated_at
class ConsolePool(**kwargs)

Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase

Represents pool of consoles on the same physical node.

ConsolePool.address
ConsolePool.compute_host
ConsolePool.console_type
ConsolePool.created_at
ConsolePool.deleted
ConsolePool.deleted_at
ConsolePool.host
ConsolePool.id
ConsolePool.password
ConsolePool.public_hostname
ConsolePool.updated_at
ConsolePool.username
class DNSDomain(**kwargs)

Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase

Represents a DNS domain with availability zone or project info.

DNSDomain.availability_zone
DNSDomain.created_at
DNSDomain.deleted
DNSDomain.deleted_at
DNSDomain.domain
DNSDomain.project_id
DNSDomain.scope
DNSDomain.updated_at
class FixedIp(**kwargs)

Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase

Represents a fixed ip for an instance.

FixedIp.address
FixedIp.allocated
FixedIp.created_at
FixedIp.deleted
FixedIp.deleted_at
FixedIp.host
FixedIp.id
FixedIp.instance_uuid
FixedIp.leased
FixedIp.network_id
FixedIp.reserved
FixedIp.updated_at
FixedIp.virtual_interface_id
class FloatingIp(**kwargs)

Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase

Represents a floating ip that dynamically forwards to a fixed ip.

FloatingIp.address
FloatingIp.auto_assigned
FloatingIp.created_at
FloatingIp.deleted
FloatingIp.deleted_at
FloatingIp.fixed_ip_id
FloatingIp.host
FloatingIp.id
FloatingIp.interface
FloatingIp.pool
FloatingIp.project_id
FloatingIp.updated_at
class Instance(**kwargs)

Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase

Represents a guest VM.

Instance.access_ip_v4
Instance.access_ip_v6
Instance.architecture
Instance.auto_disk_config
Instance.availability_zone
Instance.config_drive
Instance.created_at
Instance.default_ephemeral_device
Instance.default_swap_device
Instance.deleted
Instance.deleted_at
Instance.disable_terminate
Instance.display_description
Instance.display_name
Instance.ephemeral_gb
Instance.host
Instance.hostname
Instance.id
Instance.image_ref
Instance.instance_type_id
Instance.kernel_id
Instance.key_data
Instance.key_name
Instance.launch_index
Instance.launched_at
Instance.launched_on
Instance.locked
Instance.memory_mb
Instance.name
Instance.os_type
Instance.power_state
Instance.progress
Instance.project_id
Instance.ramdisk_id
Instance.reservation_id
Instance.root_device_name
Instance.root_gb
Instance.scheduled_at
Instance.server_name
Instance.shutdown_terminate
Instance.task_state
Instance.terminated_at
Instance.updated_at
Instance.user_data
Instance.user_id
Instance.uuid
Instance.vcpus
Instance.vm_mode
Instance.vm_state
class InstanceFault(**kwargs)

Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase

InstanceFault.code
InstanceFault.created_at
InstanceFault.deleted
InstanceFault.deleted_at
InstanceFault.details
InstanceFault.id
InstanceFault.instance_uuid
InstanceFault.message
InstanceFault.updated_at
class InstanceIdMapping(**kwargs)

Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase

Compatability layer for the EC2 instance service

InstanceIdMapping.created_at
InstanceIdMapping.deleted
InstanceIdMapping.deleted_at
InstanceIdMapping.id
InstanceIdMapping.updated_at
InstanceIdMapping.uuid
class InstanceInfoCache(**kwargs)

Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase

Represents a cache of information about an instance

InstanceInfoCache.created_at
InstanceInfoCache.deleted
InstanceInfoCache.deleted_at
InstanceInfoCache.id
InstanceInfoCache.instance
InstanceInfoCache.instance_uuid
InstanceInfoCache.network_info
InstanceInfoCache.updated_at
class InstanceMetadata(**kwargs)

Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase

Represents a user-provided metadata key/value pair for an instance

InstanceMetadata.created_at
InstanceMetadata.deleted
InstanceMetadata.deleted_at
InstanceMetadata.id
InstanceMetadata.instance
InstanceMetadata.instance_uuid
InstanceMetadata.key
InstanceMetadata.updated_at
InstanceMetadata.value
class InstanceSystemMetadata(**kwargs)

Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase

Represents a system-owned metadata key/value pair for an instance

InstanceSystemMetadata.created_at
InstanceSystemMetadata.deleted
InstanceSystemMetadata.deleted_at
InstanceSystemMetadata.id
InstanceSystemMetadata.instance
InstanceSystemMetadata.instance_uuid
InstanceSystemMetadata.key
InstanceSystemMetadata.updated_at
InstanceSystemMetadata.value
class InstanceTypeExtraSpecs(**kwargs)

Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase

Represents additional specs as key/value pairs for an instance_type

InstanceTypeExtraSpecs.created_at
InstanceTypeExtraSpecs.deleted
InstanceTypeExtraSpecs.deleted_at
InstanceTypeExtraSpecs.id
InstanceTypeExtraSpecs.instance_type
InstanceTypeExtraSpecs.instance_type_id
InstanceTypeExtraSpecs.key
InstanceTypeExtraSpecs.updated_at
InstanceTypeExtraSpecs.value
class InstanceTypeProjects(**kwargs)

Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase

Represent projects associated instance_types

InstanceTypeProjects.created_at
InstanceTypeProjects.deleted
InstanceTypeProjects.deleted_at
InstanceTypeProjects.id
InstanceTypeProjects.instance_type
InstanceTypeProjects.instance_type_id
InstanceTypeProjects.project_id
InstanceTypeProjects.updated_at
class InstanceTypes(**kwargs)

Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase

Represent possible instance_types or flavor of VM offered

InstanceTypes.created_at
InstanceTypes.deleted
InstanceTypes.deleted_at
InstanceTypes.disabled
InstanceTypes.ephemeral_gb
InstanceTypes.flavorid
InstanceTypes.id
InstanceTypes.instances
InstanceTypes.is_public
InstanceTypes.memory_mb
InstanceTypes.name
InstanceTypes.root_gb
InstanceTypes.rxtx_factor
InstanceTypes.swap
InstanceTypes.updated_at
InstanceTypes.vcpu_weight
InstanceTypes.vcpus
class IscsiTarget(**kwargs)

Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase

Represents an iscsi target for a given host

IscsiTarget.created_at
IscsiTarget.deleted
IscsiTarget.deleted_at
IscsiTarget.host
IscsiTarget.id
IscsiTarget.target_num
IscsiTarget.updated_at
IscsiTarget.volume
IscsiTarget.volume_id
class KeyPair(**kwargs)

Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase

Represents a public key pair for ssh.

KeyPair.created_at
KeyPair.deleted
KeyPair.deleted_at
KeyPair.fingerprint
KeyPair.id
KeyPair.name
KeyPair.public_key
KeyPair.updated_at
KeyPair.user_id
class Migration(**kwargs)

Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase

Represents a running host-to-host migration.

Migration.created_at
Migration.deleted
Migration.deleted_at
Migration.dest_compute
Migration.dest_host
Migration.id
Migration.instance_uuid
Migration.new_instance_type_id
Migration.old_instance_type_id
Migration.source_compute
Migration.status
Migration.updated_at
class Network(**kwargs)

Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase

Represents a network.

Network.bridge
Network.bridge_interface
Network.broadcast
Network.cidr
Network.cidr_v6
Network.created_at
Network.deleted
Network.deleted_at
Network.dhcp_start
Network.dns1
Network.dns2
Network.gateway
Network.gateway_v6
Network.host
Network.id
Network.injected
Network.label
Network.multi_host
Network.netmask
Network.netmask_v6
Network.priority
Network.project_id
Network.rxtx_base
Network.updated_at
Network.uuid
Network.vlan
Network.vpn_private_address
Network.vpn_public_address
Network.vpn_public_port
class NovaBase

Bases: object

Base class for Nova Models.

NovaBase.delete(session=None)

Delete this object.

NovaBase.get(key, default=None)
NovaBase.iteritems()

Make the model object behave like a dict.

Includes attributes from joins.

NovaBase.next()
NovaBase.save(session=None)

Save this object.

NovaBase.update(values)

Make the model object behave like a dict

class ProviderFirewallRule(**kwargs)

Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase

Represents a rule in a security group.

ProviderFirewallRule.cidr
ProviderFirewallRule.created_at
ProviderFirewallRule.deleted
ProviderFirewallRule.deleted_at
ProviderFirewallRule.from_port
ProviderFirewallRule.id
ProviderFirewallRule.protocol
ProviderFirewallRule.to_port
ProviderFirewallRule.updated_at
class Quota(**kwargs)

Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase

Represents a single quota override for a project.

If there is no row for a given project id and resource, then the default for the quota class is used. If there is no row for a given quota class and resource, then the default for the deployment is used. If the row is present but the hard limit is Null, then the resource is unlimited.

Quota.created_at
Quota.deleted
Quota.deleted_at
Quota.hard_limit
Quota.id
Quota.project_id
Quota.resource
Quota.updated_at
class QuotaClass(**kwargs)

Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase

Represents a single quota override for a quota class.

If there is no row for a given quota class and resource, then the default for the deployment is used. If the row is present but the hard limit is Null, then the resource is unlimited.

QuotaClass.class_name
QuotaClass.created_at
QuotaClass.deleted
QuotaClass.deleted_at
QuotaClass.hard_limit
QuotaClass.id
QuotaClass.resource
QuotaClass.updated_at
class QuotaUsage(**kwargs)

Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase

Represents the current usage for a given resource.

QuotaUsage.created_at
QuotaUsage.deleted
QuotaUsage.deleted_at
QuotaUsage.id
QuotaUsage.in_use
QuotaUsage.project_id
QuotaUsage.reserved
QuotaUsage.resource
QuotaUsage.total
QuotaUsage.until_refresh
QuotaUsage.updated_at
class Reservation(**kwargs)

Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase

Represents a resource reservation for quotas.

Reservation.created_at
Reservation.deleted
Reservation.deleted_at
Reservation.delta
Reservation.expire
Reservation.id
Reservation.project_id
Reservation.resource
Reservation.updated_at
Reservation.usage
Reservation.usage_id
Reservation.uuid
class S3Image(**kwargs)

Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase

Compatibility layer for the S3 image service talking to Glance

S3Image.created_at
S3Image.deleted
S3Image.deleted_at
S3Image.id
S3Image.updated_at
S3Image.uuid
class SMBackendConf(**kwargs)

Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase

Represents the connection to the backend for SM.

SMBackendConf.config_params
SMBackendConf.created_at
SMBackendConf.deleted
SMBackendConf.deleted_at
SMBackendConf.flavor_id
SMBackendConf.id
SMBackendConf.sr_type
SMBackendConf.sr_uuid
SMBackendConf.updated_at
class SMFlavors(**kwargs)

Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase

Represents a flavor for SM volumes.

SMFlavors.created_at
SMFlavors.deleted
SMFlavors.deleted_at
SMFlavors.description
SMFlavors.id
SMFlavors.label
SMFlavors.updated_at
class SMVolume(**kwargs)

Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase

SMVolume.backend_id
SMVolume.created_at
SMVolume.deleted
SMVolume.deleted_at
SMVolume.id
SMVolume.updated_at
SMVolume.vdi_uuid
class SecurityGroup(**kwargs)

Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase

Represents a security group.

SecurityGroup.created_at
SecurityGroup.deleted
SecurityGroup.deleted_at
SecurityGroup.description
SecurityGroup.id
SecurityGroup.instances
SecurityGroup.name
SecurityGroup.project_id
SecurityGroup.updated_at
SecurityGroup.user_id
class SecurityGroupIngressRule(**kwargs)

Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase

Represents a rule in a security group.

SecurityGroupIngressRule.cidr
SecurityGroupIngressRule.created_at
SecurityGroupIngressRule.deleted
SecurityGroupIngressRule.deleted_at
SecurityGroupIngressRule.from_port
SecurityGroupIngressRule.grantee_group
SecurityGroupIngressRule.group_id
SecurityGroupIngressRule.id
SecurityGroupIngressRule.parent_group
SecurityGroupIngressRule.parent_group_id
SecurityGroupIngressRule.protocol
SecurityGroupIngressRule.to_port
SecurityGroupIngressRule.updated_at
class SecurityGroupInstanceAssociation(**kwargs)

Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase

SecurityGroupInstanceAssociation.created_at
SecurityGroupInstanceAssociation.deleted
SecurityGroupInstanceAssociation.deleted_at
SecurityGroupInstanceAssociation.id
SecurityGroupInstanceAssociation.instance_uuid
SecurityGroupInstanceAssociation.security_group_id
SecurityGroupInstanceAssociation.updated_at
class Service(**kwargs)

Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase

Represents a running service on a host.

Service.availability_zone
Service.binary
Service.created_at
Service.deleted
Service.deleted_at
Service.disabled
Service.host
Service.id
Service.report_count
Service.topic
Service.updated_at
class Snapshot(**kwargs)

Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase

Represents a block storage device that can be attached to a VM.

Snapshot.created_at
Snapshot.deleted
Snapshot.deleted_at
Snapshot.display_description
Snapshot.display_name
Snapshot.id
Snapshot.name
Snapshot.progress
Snapshot.project_id
Snapshot.status
Snapshot.updated_at
Snapshot.user_id
Snapshot.volume_id
Snapshot.volume_name
Snapshot.volume_size
class SnapshotIdMapping(**kwargs)

Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase

Compatibility layer for the EC2 snapshot service

SnapshotIdMapping.created_at
SnapshotIdMapping.deleted
SnapshotIdMapping.deleted_at
SnapshotIdMapping.id
SnapshotIdMapping.updated_at
SnapshotIdMapping.uuid
class TaskLog(**kwargs)

Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase

Audit log for background periodic tasks

TaskLog.created_at
TaskLog.deleted
TaskLog.deleted_at
TaskLog.errors
TaskLog.host
TaskLog.id
TaskLog.message
TaskLog.period_beginning
TaskLog.period_ending
TaskLog.state
TaskLog.task_items
TaskLog.task_name
TaskLog.updated_at
class VirtualInterface(**kwargs)

Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase

Represents a virtual interface on an instance.

VirtualInterface.address
VirtualInterface.created_at
VirtualInterface.deleted
VirtualInterface.deleted_at
VirtualInterface.id
VirtualInterface.instance_uuid
VirtualInterface.network_id
VirtualInterface.updated_at
VirtualInterface.uuid
class Volume(**kwargs)

Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase

Represents a block storage device that can be attached to a VM.

Volume.attach_status
Volume.attach_time
Volume.availability_zone
Volume.created_at
Volume.deleted
Volume.deleted_at
Volume.display_description
Volume.display_name
Volume.ec2_id
Volume.host
Volume.id
Volume.instance_uuid
Volume.launched_at
Volume.mountpoint
Volume.name
Volume.project_id
Volume.provider_auth
Volume.provider_location
Volume.scheduled_at
Volume.size
Volume.snapshot_id
Volume.status
Volume.terminated_at
Volume.updated_at
Volume.user_id
Volume.volume_type_id
class VolumeIdMapping(**kwargs)

Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase

Compatibility layer for the EC2 volume service

VolumeIdMapping.created_at
VolumeIdMapping.deleted
VolumeIdMapping.deleted_at
VolumeIdMapping.id
VolumeIdMapping.updated_at
VolumeIdMapping.uuid
class VolumeMetadata(**kwargs)

Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase

Represents a metadata key/value pair for a volume

VolumeMetadata.created_at
VolumeMetadata.deleted
VolumeMetadata.deleted_at
VolumeMetadata.id
VolumeMetadata.key
VolumeMetadata.updated_at
VolumeMetadata.value
VolumeMetadata.volume
VolumeMetadata.volume_id
class VolumeTypeExtraSpecs(**kwargs)

Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase

Represents additional specs as key/value pairs for a volume_type

VolumeTypeExtraSpecs.created_at
VolumeTypeExtraSpecs.deleted
VolumeTypeExtraSpecs.deleted_at
VolumeTypeExtraSpecs.id
VolumeTypeExtraSpecs.key
VolumeTypeExtraSpecs.updated_at
VolumeTypeExtraSpecs.value
VolumeTypeExtraSpecs.volume_type
VolumeTypeExtraSpecs.volume_type_id
class VolumeTypes(**kwargs)

Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase

Represent possible volume_types of volumes offered

VolumeTypes.created_at
VolumeTypes.deleted
VolumeTypes.deleted_at
VolumeTypes.id
VolumeTypes.name
VolumeTypes.updated_at
VolumeTypes.volumes

The nova.db.sqlalchemy.session Module

Session Handling for SQLAlchemy backend.

add_regexp_listener(dbapi_con, con_record)

Add REGEXP function to sqlite connections.

debug_mysql_do_query()

Return a debug version of MySQLdb.cursors._do_query

get_engine()

Return a SQLAlchemy engine.

get_maker(engine, autocommit=True, expire_on_commit=False)

Return a SQLAlchemy sessionmaker using the given engine.

get_session(autocommit=True, expire_on_commit=False)

Return a SQLAlchemy session.

is_db_connection_error(args)

Return True if error in connecting to db.

ping_listener(dbapi_conn, connection_rec, connection_proxy)

Ensures that MySQL connections checked out of the pool are alive.

Borrowed from: http://groups.google.com/group/sqlalchemy/msg/a4ce563d802c929f

synchronous_switch_listener(dbapi_conn, connection_rec)

Switch sqlite connections to non-synchronous mode

Tests

Tests are lacking for the db api layer and for the sqlalchemy driver. Failures in the drivers would be detected in other test cases, though.