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) |
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.
Allow access to share.
Returns share access by given type and access.
Allow access to share.
Update access record.
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 host.
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.
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.
Get all backend details records for share server.
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 free share servers DB records.
Get share server DB records by host.
Get share server DB records by host and share net.
Get share server DB records by host and share net not error.
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.
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: oslo_db.sqlalchemy.models.ModelBase, oslo_db.sqlalchemy.models.TimestampMixin, oslo_db.sqlalchemy.models.SoftDeleteMixin
Base class for Manila Models.
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 NFS.
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 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.