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) |
Bases: nova.exception.Error
No more available networks.
Bases: nova.exception.Error
No more available targets
Create a new agent build entry.
Destroy agent build entry.
Get all agent builds.
Get agent build by hypervisor/OS/architecture triple.
Update agent build entry.
Create a new aggregate with metadata.
Delete an aggregate.
Get a specific aggregate by id.
Get all aggregates.
Get a specific aggregate by host
Add host to the aggregate.
Delete the given host from the aggregate.
Get hosts for the specified aggregate.
Add/update metadata. If set_delete=True, it adds only.
Delete the given metadata key.
Get metadata for the specified aggregate.
Update the attributes of an aggregates. If values contains a metadata key, it updates the aggregate metadata too.
Creates a new token.
Destroy an auth token.
Retrieves a token given the hash representing it.
Updates a token given the hash representing it.
Create an entry of block device mapping
Destroy the block device mapping.
Destroy the block device mapping or raise if it does not exist.
Get all block device mapping belonging to a instance
Update an entry of block device mapping
Update an entry of block device mapping. If not existed, create a new entry
Return bw usages for an instance in a given audit period.
Update cached bw usage for an instance and network Creates new record if needed.
Create a new child Cell entry.
Delete a child Cell.
Get a specific child Cell.
Get all child Cells.
Update a child Cell entry.
Create a certificate from the values dictionary.
Get all certificates for a project.
Get all certificates for a user.
Get all certificates for a user and project.
Create a computeNode from the values dictionary.
Get an computeNode or raise if it does not exist.
Get all computeNodes.
Set the given properties on an computeNode and update it.
Raises NotFound if computeNode does not exist.
Create a console.
Delete a console.
Get a specific console (possibly on a given instance).
Get consoles for a given instance.
Get console entry for a given instance and pool.
Create console pool.
Get a console pool.
Fetch all pools for given proxy host and type.
Fetch a console pool for a given proxy host, compute host, and type.
Get the db record for the specified domain.
Get a list of all zones in our database, public and private.
Associated a DNS domain with a project id
Associated a DNS domain with an availability zone
Purge associations for the specified DNS zone
Associate fixed ip to instance.
Raises if fixed ip is not available.
Find free ip in network and associate it to instance or host.
Raises if one is not available.
Create a lot of fixed ips from the values dictionary.
Create a fixed ip from the values dictionary.
Disassociate a fixed ip from an instance by address.
Disassociate old fixed ips from host.
Get fixed ip by id or raise if it does not exist.
Get all defined fixed ips.
Get a fixed ip by address or raise if it does not exist.
Get fixed ips by instance or raise if none exist.
Get fixed ip for a host in a network.
Get a network for a fixed ip by address.
Create a fixed ip from the values dictionary.
Get fixed ips by virtual interface or raise if none exist.
Allocate free floating ip from specified pool and return the address.
Raises if one is not available.
Count floating ips used by project.
Create a floating ip from the values dictionary.
Deallocate an floating ip by address.
Destroy the floating_ip or raise if it does not exist.
Disassociate an floating ip from a fixed ip by address.
Returns: | the address of the existing fixed ip. |
---|
Associate an floating ip to a fixed_ip by address.
Get all floating ips.
Get all floating ips by host.
Get all floating ips by project.
Get a floating ip by address or raise if it doesn’t exist.
Get a floating ips by fixed address
Get a floating ips by fixed address
Returns a list of floating ip pools
Set auto_assigned flag to floating ip
Update a floating ip by address or raise if it doesn’t exist.
Create an instance action from the values dictionary.
Associate the given security group with the given instance.
Create an instance from the values dictionary.
Get (instance_count, total_cores, total_ram) for project.
Destroy the instance or raise if it does not exist.
Create a new Instance Fault.
Get all instance faults for the provided instance_uuids.
Get an instance or raise if it does not exist.
Get instance actions by instance uuid.
Get instances active during a certain time window.
Specifying a project_id will filter for a certain project.
Get instances and joins active during a certain time window.
Specifying a project_id will filter for a certain project.
Get all instances.
Get all instances that match all filters.
Get all instance belonging to a host.
Get all instance belonging to a project.
Get all instances belonging to a reservation.
Get all instances stuck in a rebooting state.
Get an instance or raise if it does not exist.
Get the first floating ip address of an instance.
Return a dictionary containing ‘ID: UUID’ given the ids
Create a new instance cache record in the table.
Parameters: |
|
---|
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: |
|
---|
Delete the given metadata item.
Get all metadata for an instance.
Update metadata if it exists, otherwise create it.
Disassociate the given security group from the given instance.
Atomically check if an instance is in a valid state, and if it is, set the instance into a new state.
Create a new instance type.
Delete a instance type.
Delete the given extra specs item.
Get all extra specs for an instance type.
Create or update instance type extra specs. This adds or modifies the key/value pairs specified in the extra specs dict argument
Get instance type by id.
Get all instance types.
Get instance type by name.
Get instance type by name.
Set the given properties on an instance and update it.
Raises NotFound if instance does not exist.
Return count of export devices.
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.
Create a key_pair from the values dictionary.
Destroy the key_pair or raise if it does not exist.
Destroy all key_pairs by user.
Get a key_pair or raise if it does not exist.
Get all key_pairs by user.
Create a migration record.
Finds a migration by the id.
Finds all unconfirmed migrations within the confirmation window.
Finds a migration by the instance uuid its migrating.
Update a migration instance.
Associate a free network to a project.
Return the number of networks.
Return the number of reserved ips in the network.
Create the ips for the network, reserving sepecified ips.
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.
Delete network with key network_id.
This method assumes that the network is not associated with any project
Disassociate the network from project or raise if it does not exist.
Get an network or raise if it does not exist.
Return all defined networks.
All networks for which the given host is the network host.
Get all networks by instance id or raise if none exist.
Return networks by ids.
Get all network’s ips that have been associated.
Get a network by bridge or raise if it does not exist.
Get a network by cidr or raise if it does not exist
Get a network by instance id or raise if it does not exist.
Get a network by uuid or raise if it does not exist.
Get non-conflicting index for network.
Set the Classless Inner Domain Routing for the network.
Safely set the host for network.
Set the given properties on an network and update it.
Raises NotFound if network does not exist.
Add user to project.
Create a new project.
Delete project.
Get project by id.
Get all projects.
Get all projects of which the given user is a member.
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.
Remove the given user from the given project.
Update Remove the given user from the given project.
Add a firewall rule at the provider level (all hosts & instances).
Delete a provider firewall rule from the database.
Get all provider-level firewall rules.
Return a channel to send a message to a node with a topic.
Create a quota for the given project and resource.
Destroy the quota or raise if it does not exist.
Destroy all quotas associated with a given project.
Retrieve a quota or raise if it does not exist.
Retrieve all quotas associated with a given project.
Update a quota or raise if it does not exist.
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
Count number of security groups in a project.
Create a new security group.
Deletes a security group.
Indicates if a group name exists in a project.
Get security group by its id.
Get all security groups.
Get security groups to which the instance is assigned.
Returns a security group with the specified name from a project.
Get all security groups belonging to a project.
Indicates if a security group is currently in use.
Count rules in a given security group.
Create a new security group.
Deletes a security group rule.
Gets a security group rule.
Get all rules for a a given security group.
Get all rules that grant access to the given security group.
Create a service from the values dictionary.
Destroy the service or raise if it does not exist.
Get a service or raise if it does not exist.
Get all services.
Get all services for a given host.
Get all services for a given topic.
Get all compute services for a given host.
Get all compute services sorted by instance count.
Returns: | a list of (Service, instance_count) tuples. |
---|
Get all volume services sorted by volume count.
Returns: | a list of (Service, volume_count) tuples. |
---|
Get the state of an service by node name and binary.
Get a service by host it’s on and topic it listens to.
Set the given properties on an service and update it.
Raises NotFound if service does not exist.
Create a new SM Backend Config entry.
Delete a SM Backend Config.
Get a specific SM Backend Config.
Get all SM Backend Configs.
Get a specific SM Backend Config.
Update a SM Backend Config entry.
Create a new SM Flavor entry.
Delete a SM Flavor.
Get a specific SM Flavor.
Get all SM Flavors.
Update a SM Flavor entry.
Create a new child Zone entry.
Delete a child Zone.
Get a specific child Zone.
Get all child Zones.
Update a child Zone entry.
Create a snapshot from the values dictionary.
Destroy the snapshot or raise if it does not exist.
Get a snapshot or raise if it does not exist.
Get all snapshots.
Get all snapshots belonging to a project.
Get all snapshots for a volume.
Set the given properties on an snapshot and update it.
Raises NotFound if snapshot does not exist.
Add project role for user.
Add another global role for user.
Create a new user.
Delete a user.
Get user by id.
Create a new user.
Get user by access key.
Get user by uid.
Get global roles for user.
Return list of roles a user holds on project.
Remove project role from user.
Remove global role from user.
Update user.
Create a virtual interface record in the database.
Delete virtual interface record from the database.
Delete virtual interface records associated with instance.
Gets a virtual interface from the table,
Gets all virtual interfaces from the table
Gets a virtual interface from the table filtering on address.
Gets all virtual_interfaces for instance.
Gets all virtual interfaces for instance.
Gets a virtual interface from the table filtering on vif uuid.
Atomically allocate a free iscsi_target from the pool.
Ensure that a volume is set as attached.
Create a volume from the values dictionary.
Get (volume_count, gigabytes) for project.
Destroy the volume or raise if it does not exist.
Ensure that a volume is set as detached.
Get a volume or raise if it does not exist.
Get all volumes.
Get all volumes belonging to a host.
Get all volumes belonging to a instance.
Get all volumes belonging to a project.
Get a volume by ec2 id.
Get the instance that a volume is attached to.
Get the target num (tid) allocated to the volume.
Delete the given metadata item.
Get all metadata for a volume.
Update metadata if it exists, otherwise create it.
Create a new volume type.
Delete a volume type.
Delete the given extra specs item.
Get all extra specs for a volume type.
Create or update volume type extra specs. This adds or modifies the key/value pairs specified in the extra specs dict argument
Get volume type by id.
Get all volume types.
Get volume type by name.
Set the given properties on an volume and update it.
Raises NotFound if volume does not exist.