Defines interface for DB access.
The underlying driver is loaded as a LazyPluggable.
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 addresses.
Bases: nova.exception.Error
No more available blades.
Bases: nova.exception.Error
No more available networks.
Bases: nova.exception.Error
No more available blades
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 a certificate from the values dictionary.
Destroy the certificate or raise if it does not exist.
Get all certificates for a project.
Get all certificates for a user.
Get all certificates for a user and project.
Set the given properties on an certificate and update it.
Raises NotFound if service does not exist.
Create a computeNode from the values dictionary.
Get an computeNode or raise if it does not exist.
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.
Return count of export devices.
Create an export_device from the values dictionary.
The device is not returned. If the create violates the unique constraints because the shelf_id and blade_id already exist, no exception is raised.
Associate fixed ip to instance.
Raises if fixed ip is not available.
Find free ip in network and associate it to instance.
Raises if one is not available.
Create a fixed ip from the values dictionary.
Disassociate a fixed ip from an instance by address.
Disassociate old fixed ips from host.
Get all defined fixed ips.
Get all defined fixed ips used by a host.
Get fixed ips by instance or raise if none exist.
Get a fixed ip by address or raise if it does not exist.
Get an instance for a fixed ip by address.
Get a network for a fixed ip by address.
Create a fixed ip from the values dictionary.
Allocate free floating ip 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.
Update a floating ip by address or raise if it doesn’t exist.
Return all networks for which the given host is the designated network host.
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, core_count) for project.
Destroy the instance or raise if it does not exist.
Get an instance or raise if it does not exist.
Get instance actions by instance id.
Get all instances.
Get all instance belonging to a host.
Get all instance belonging to a project.
Get all instance belonging to a reservation.
Get all instances.
Get total amount of disk by host and project.
Get the fixed ip address of an instance.
Get the first floating ip address of an instance.
Get amount of memory by host and project.
Get a vpn instance by project or return None.
Get instances.vcpus by host and project.
True if instance is a vpn.
Delete the given metadata item
Get all metadata for an instance
Create or update instance metadata
Set the state of an instance.
Create a new instance type
Delete a instance type
Get all instance types
Get instance type by name
Get instance type by id
Get instance type by name
Purges (removes) an instance type from DB Use instance_type_destroy for most cases
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 a migration by the instance id its migrating
Update a migration instance
Associate a free network to a project.
Return the number of networks.
Return the number of allocated non-reserved ips in the network.
Return the number of available ips in the network.
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.
Disassociate all networks from projects.
Get an network or raise if it does not exist.
Return all defined networks.
Get all networks by instance id or raise if none exist.
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 non-conflicting index for network.
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.
Return a channel to send a message to a node with a topic.
Create a quota from the values dictionary.
Destroy the quota or raise if it does not exist.
Retrieve a quota or raise if it does not exist.
Update a quota from the values dictionary.
Create a new security group.
Deletes a 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.
Create a new security group.
Deletes 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 network services sorted by network count.
Returns a list of (Service, network_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.
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.
Atomically allocate a free iscsi_target from the pool.
Atomically allocate a free shelf and blade 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.
Get the shelf and blade allocated to the volume.
Set the given properties on an volume and update it.
Raises NotFound if volume does not exist.
Create a new child Zone entry.
Delete a child Zone.
Get a specific child Zone.
Get all child Zones.
Update a child Zone entry.
Implementation of SQLAlchemy backend.
SQLAlchemy models for nova data.
Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase
Represents an authorization token for all API transactions.
Fields are a string representing the actual token and a user id for mapping to the actual user
Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase
Represents a an x509 certificate
Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase
Represents a running compute service on a host.
Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase
Represents a console session for an instance.
Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase
Represents pool of consoles on the same physical node.
Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase
Represates a shelf and blade that a volume can be exported on.
Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase
Represents a fixed ip for an instance.
Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase
Represents a floating ip that dynamically forwards to a fixed ip.
Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase
Represents a guest vm.
Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase
Represents a guest VM’s actions and results
Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase
Represents a metadata key/value pair for an instance
Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase
Represent possible instance_types or flavor of VM offered
Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase
Represates an iscsi target for a given host
Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase
Represents a public key pair for ssh.
Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase
Represents a running host-to-host migration.
Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase
Represents a network.
Bases: object
Base class for Nova Models.
Delete this object.
Make the model object behave like a dict.
Includes attributes from joins.
Save this object.
Make the model object behave like a dict
Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase
Represents a project.
Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase
Represents quota overrides for a project.
Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase
Represents a security group.
Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase
Represents a rule in a security group.
Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase
Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase
Represents a running service on a host.
Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase
Represents a user.
Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase
Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase
Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase
Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase
Represents a block storage device that can be attached to a vm.
Bases: sqlalchemy.ext.declarative.Base, nova.db.sqlalchemy.models.NovaBase
Represents a child zone of this zone.
Register Models and create metadata.
Called from nova.db.sqlalchemy.__init__ as part of loading the driver, it will never need to be called explicitly elsewhere unless the connection is lost and needs to be reestablished.
Session Handling for SQLAlchemy backend
Helper method to grab session
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.