Defines interface for DB access.
The underlying driver is loaded as a LazyPluggable.
Functions in this module are imported into the manila.db namespace. Call these functions from manila.db namespace, not the manila.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
backend: | string to lookup in the list of LazyPluggable backends. sqlalchemy is the only supported backend right now. |
---|---|
connection: | string specifying the sqlalchemy connection to use, like: sqlite:///var/lib/manila/manila.sqlite. |
enable_new_services: | |
when adding a new service to the database, is it in the pool of available hardware (Default: True) |
Get availability zone by name or id.
Get all active availability zones.
Create a cgsnapshot from the values dictionary.
Destroy the cgsnapshot or raise if it does not exist.
Get a cgsnapshot.
Get all cgsnapshots.
Get all cgsnapshots belonging to a project.
Create a cgsnapshot member from the values dictionary.
Set the given properties on a cgsnapshot member and update it.
Raises NotFound if cgsnapshot member does not exist.
Return the members of a cgsnapshot.
Set the given properties on a cgsnapshot and update it.
Raises NotFound if cgsnapshot does not exist.
Create a consistency group from the values dictionary.
Destroy the consistency group or raise if it does not exist.
Get a consistency group or raise if it does not exist.
Get all consistency groups.
Get all consistency groups belonging to a host.
Get all consistency groups belonging to a project.
Set the given properties on a consistency group and update it.
Raises NotFound if consistency group does not exist.
Returns the number of cgsnapshot members linked to the share.
Returns the number of undeleted cgsnapshots with the specified cg.
Returns the number of undeleted cgs with the specified share network.
Returns the number of undeleted shares with the specified cg.
Remove one, list or all key-value pairs for given host and entity_id.
Get one, list or all key-value pairs for given host and entity_id.
Update key-value pairs for given host and entity_id.
Create a network allocation DB record.
Delete a network allocation DB record.
Update a network allocation DB record.
Get network allocations by IP address.
Get network allocation for share server.
Create a quota class for the given name and resource.
Retrieve a quota class or raise if it does not exist.
Retrieve all quotas associated with a given quota class.
Retrieve all default quotas.
Update a quota class or raise if it does not exist.
Create a quota for the given project and resource.
Destroy all quotas associated with a given project.
Destroy all quotas associated with a given project and user.
Retrieve a quota or raise if it does not exist.
Retrieve all user quotas associated with a given project.
Retrieve all quotas associated with a given project.
Retrieve all quotas associated with a given project and user.
Check quotas and create appropriate reservations.
Update a quota or raise if it does not exist.
Create a quota usage.
Retrieve a quota usage or raise if it does not exist.
Retrieve all usage associated with a given resource.
Retrieve all usage associated with a given resource.
Update a quota usage or raise if it does not exist.
Commit quota reservations.
Create a reservation for the given project and resource.
Roll back any expired reservations.
Retrieve a reservation or raise if it does not exist.
Roll back quota reservations.
Create security service DB record.
Delete security service DB record.
Get security service DB record.
Get all security service DB records.
Get all security service DB records for the given project.
Update security service DB record.
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 share services sorted by share count.
Returns: | a list of (Service, share_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.
Allow access to share.
Deny access to share.
Get share access rule.
Returns share access by given type and access.
Get all access rules for given share.
Create new share.
Get (share_count, gigabytes) for project.
Delete share.
Get all exports_locations of share.
Update export locations of share.
Get share by id.
Get all shares.
Returns all shares with given project ID and CG id.
Returns all shares with given project ID.
Returns list of shares that belong to given share network.
Returns all shares with given share server ID.
Deny access to share instance.
Get access rule mapping for share instance.
Get access rules to all share instances.
Update state of access rule mapping.
Create new share instance.
Delete share instance.
Get share instance by id.
Update share instance fields.
Returns all share instances.
Returns list of share instances that belong to given cg.
Returns all share instances with given host.
Returns list of shares that belong to given share.
Returns list of shares that belong to given share network.
Returns all share instances with given share_server_id.
Delete the given metadata item.
Get all metadata for a share.
Update metadata if it exists, otherwise create it.
Create a share network DB record.
Delete a share network DB record.
Get requested share network DB record.
Get all share network DB records.
Get all share network DB records for the given project.
Get all share network DB records for the given project.
Update a share network DB record.
Create DB record with backend details.
Create share server DB record.
Delete share server DB record.
Get share server DB record by ID.
Get all share server DB records.
Get all share servers related to particular host.
Get share server DB records by host and share net not error.
Get all free share servers DB records.
Get share server DB records by host.
Get share server DB records by host and share net.
Update share server DB record.
Create a snapshot from the values dictionary.
Get count and gigabytes used for snapshots for specified project.
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 share.
Get a snapshot or raise if it does not exist.
Set the given properties on an snapshot instance and update it.
Raises NotFound if snapshot instance does not exist.
Set the given properties on an snapshot and update it.
Raises NotFound if snapshot does not exist.
Add share type access for project.
Get all share type access of a share type.
Remove share type access for project.
Create a new share type.
Delete a share type.
Delete the given extra specs item.
Get all extra specs for a share type.
Create or update share type extra specs.
This adds or modifies the key/value pairs specified in the extra specs dict argument.
Get share type by id.
Parameters: |
|
---|---|
Returns: | share type |
Get all share types.
Parameters: |
|
---|---|
Returns: | list of matching share types |
Get share type by name.
Get all qos specs for given share type.
Update share fields.
Get (snapshot_count, gigabytes) for project.
Get all the volumes inside the window.
Specifying a project_id will filter for a certain project.
Implementation of SQLAlchemy backend.
SQLAlchemy models for Manila data.
Bases: sqlalchemy.ext.declarative.api.Base, manila.db.sqlalchemy.models.ManilaBase
Represents a private data as key-value pairs for a driver.
Bases: sqlalchemy.ext.declarative.api.Base, manila.db.sqlalchemy.models.ManilaBase
Represents a cgsnapshot.
Bases: sqlalchemy.ext.declarative.api.Base, manila.db.sqlalchemy.models.ManilaBase
Represents the share snapshots in a consistency group snapshot.
Bases: sqlalchemy.ext.declarative.api.Base, manila.db.sqlalchemy.models.ManilaBase
Represents a consistency group.
Bases: sqlalchemy.ext.declarative.api.Base, manila.db.sqlalchemy.models.ManilaBase
Represents the share types in a consistency group.
Bases: sqlalchemy.ext.declarative.api.Base, manila.db.sqlalchemy.models.ManilaBase
Represents a private data as key-value pairs for a driver.
Bases: oslo_db.sqlalchemy.models.ModelBase, oslo_db.sqlalchemy.models.TimestampMixin, oslo_db.sqlalchemy.models.SoftDeleteMixin
Base class for Manila Models.
Mark this object as deleted.
Bases: sqlalchemy.ext.declarative.api.Base, manila.db.sqlalchemy.models.ManilaBase
Represents a running manila service on a host.
Bases: sqlalchemy.ext.declarative.api.Base, manila.db.sqlalchemy.models.ManilaBase
Represents network allocation data.
Bases: sqlalchemy.ext.declarative.api.Base, manila.db.sqlalchemy.models.ManilaBase
Represents a single quota override for a user with in a project.
Bases: sqlalchemy.ext.declarative.api.Base, manila.db.sqlalchemy.models.ManilaBase
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.
Bases: sqlalchemy.ext.declarative.api.Base, manila.db.sqlalchemy.models.ManilaBase
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.
Bases: sqlalchemy.ext.declarative.api.Base, manila.db.sqlalchemy.models.ManilaBase
Represents the current usage for a given resource.
Bases: sqlalchemy.ext.declarative.api.Base, manila.db.sqlalchemy.models.ManilaBase
Represents a resource reservation for quotas.
Bases: sqlalchemy.ext.declarative.api.Base, manila.db.sqlalchemy.models.ManilaBase
Security service information for manila shares.
Bases: sqlalchemy.ext.declarative.api.Base, manila.db.sqlalchemy.models.ManilaBase
Represents a running service on a host.
Bases: sqlalchemy.ext.declarative.api.Base, manila.db.sqlalchemy.models.ManilaBase
Represents an NFS and CIFS shares.
Bases: sqlalchemy.ext.declarative.api.Base, manila.db.sqlalchemy.models.ManilaBase
Represents access to share.
Bases: sqlalchemy.ext.declarative.api.Base, manila.db.sqlalchemy.models.ManilaBase
Bases: sqlalchemy.ext.declarative.api.Base, manila.db.sqlalchemy.models.ManilaBase
Represents access to individual share instances.
Bases: sqlalchemy.ext.declarative.api.Base, manila.db.sqlalchemy.models.ManilaBase
Represents export locations of shares.
Bases: sqlalchemy.ext.declarative.api.Base, manila.db.sqlalchemy.models.ManilaBase
Represents a metadata key/value pair for a share.
Bases: sqlalchemy.ext.declarative.api.Base, manila.db.sqlalchemy.models.ManilaBase
Represents network data used by share.
Bases: sqlalchemy.ext.declarative.api.Base, manila.db.sqlalchemy.models.ManilaBase
Association table between compute_zones and compute_nodes tables.
Bases: sqlalchemy.ext.declarative.api.Base, manila.db.sqlalchemy.models.ManilaBase
Represents share server used by share.
Bases: sqlalchemy.ext.declarative.api.Base, manila.db.sqlalchemy.models.ManilaBase
Represents a metadata key/value pair for a share server.
Bases: sqlalchemy.ext.declarative.api.Base, manila.db.sqlalchemy.models.ManilaBase
Represents a snapshot of a share.
Bases: sqlalchemy.ext.declarative.api.Base, manila.db.sqlalchemy.models.ManilaBase
Represents a snapshot of a share.
Bases: sqlalchemy.ext.declarative.api.Base, manila.db.sqlalchemy.models.ManilaBase
Represents additional specs as key/value pairs for a share_type.
Bases: sqlalchemy.ext.declarative.api.Base, manila.db.sqlalchemy.models.ManilaBase
Represent projects associated share_types.
Bases: sqlalchemy.ext.declarative.api.Base, manila.db.sqlalchemy.models.ManilaBase
Represent possible share_types of volumes offered.
Register Models and create metadata.
Called from manila.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.
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.