manila.share.manager
Module¶NAS share manager managers creating shares and access rights.
Related Flags
share_driver: | Used by ShareManager . |
---|
ShareManager
(share_driver=None, service_name=None, *args, **kwargs)Bases: manila.manager.SchedulerDependentManager
Manages NAS storages.
RPC_API_VERSION
= ‘1.18’connection_get_info
(*args, **kwargs)create_replicated_snapshot
(*args, **kwargs)create_share_group
(*args, **kwargs)create_share_group_snapshot
(*args, **kwargs)create_share_instance
(*args, **kwargs)Creates a share instance.
create_share_replica
(*args, **kwargs)create_share_server
(context, share_server_id)Invoked to create a share server in this backend.
This method is invoked to create the share server defined in the model obtained by the supplied id.
Parameters: |
|
---|
create_snapshot
(*args, **kwargs)Create snapshot for share.
delete_free_share_servers
(*args, **kwargs)delete_replicated_snapshot
(*args, **kwargs)delete_share_group
(*args, **kwargs)delete_share_group_snapshot
(*args, **kwargs)delete_share_instance
(*args, **kwargs)Delete a share instance.
delete_share_replica
(*args, **kwargs)delete_share_server
(*args, **kwargs)delete_snapshot
(*args, **kwargs)Delete share snapshot.
extend_share
(*args, **kwargs)init_host
(*args, **kwargs)Initialization for a standalone service.
manage_share
(*args, **kwargs)manage_snapshot
(*args, **kwargs)migration_cancel
(*args, **kwargs)migration_complete
(*args, **kwargs)migration_driver_continue
(*args, **kwargs)Invokes driver to continue migration of shares.
migration_get_progress
(*args, **kwargs)migration_start
(*args, **kwargs)Migrates a share from current host to another host.
periodic_share_replica_snapshot_update
(*args, **kwargs)periodic_share_replica_update
(*args, **kwargs)promote_share_replica
(*args, **kwargs)provide_share_server
(context, share_instance_id, share_network_id, snapshot_id=None)Invoked to provide a compatible share server.
This method is invoked to find a compatible share server among the existing ones or create a share server database instance with the share server properties that will be used to create the share server later.
Parameters: |
|
---|---|
Returns: | The id of the share server that is being provided. |
publish_service_capabilities
(*args, **kwargs)Collect driver status and then publish it.
revert_to_snapshot
(*args, **kwargs)shrink_share
(*args, **kwargs)snapshot_update_access
(context, snapshot_instance_id)unmanage_share
(*args, **kwargs)unmanage_snapshot
(*args, **kwargs)update_access
(*args, **kwargs)Allow/Deny access to some share.
update_share_replica
(*args, **kwargs)Initiated by the force_update API.
add_hooks
(f)Hook decorator to perform action before and after a share method call
The hook decorator can perform actions before some share driver methods calls and after a call with results of driver call and preceding hook call.
locked_share_replica_operation
(operation)Lock decorator for share replica operations.
Takes a named lock prior to executing the operation. The lock is named with the id of the share to which the replica belongs.
Intended use: If a replica operation uses this decorator, it will block actions on all share replicas of the share until the named lock is free. This is used to protect concurrent operations on replicas of the same share e.g. promote ReplicaA while deleting ReplicaB, both belonging to the same share.
manila.share.driver
Module¶Drivers for shares.
ExecuteMixin
Bases: object
Provides an executable functionality to a driver class.
init_execute_mixin
(*args, **kwargs)set_execute
(execute)GaneshaMixin
Bases: object
Augment derived classes with Ganesha configuration.
init_ganesha_mixin
(*args, **kwargs)ShareDriver
(driver_handles_share_servers, *args, **kwargs)Bases: object
Class defines interface of NAS driver.
admin_network_api
allocate_admin_network
(context, share_server, count=None, **kwargs)Allocate admin network resources using given network information.
allocate_network
(context, share_server, share_network, count=None, **kwargs)Allocate network resources using given network information.
allow_access
(context, share, access, share_server=None)Allow access to the share.
check_for_setup_error
()Check for setup error.
choose_share_server_compatible_with_share
(context, share_servers, share, snapshot=None, share_group=None)Method that allows driver to choose share server for provided share.
If compatible share-server is not found, method should return None.
Parameters: |
|
---|---|
Returns: | share-server or None |
choose_share_server_compatible_with_share_group
(context, share_servers, share_group_ref, share_group_snapshot=None)connection_get_info
(context, share, share_server=None)Is called to provide necessary generic migration logic.
Parameters: |
|
---|---|
Returns: | A dictionary with migration information. |
create_replica
(context, replica_list, new_replica, access_rules, replica_snapshots, share_server=None)Replicate the active replica to a new replica on this backend.
Note
This call is made on the host that the new replica is being created upon.
Parameters: |
|
---|
Example:
[
{
'id': 'd487b88d-e428-4230-a465-a800c2cce5f8',
'share_id': 'f0e4bb5e-65f0-11e5-9d70-feff819cdc9f',
'replica_state': 'in_sync',
...
'share_server_id': '4ce78e7b-0ef6-4730-ac2a-fd2defefbd05',
'share_server': <models.ShareServer> or None,
},
{
'id': '10e49c3e-aca9-483b-8c2d-1c337b38d6af',
'share_id': 'f0e4bb5e-65f0-11e5-9d70-feff819cdc9f',
'replica_state': 'active',
...
'share_server_id': 'f63629b3-e126-4448-bec2-03f788f76094',
'share_server': <models.ShareServer> or None,
},
{
'id': 'e82ff8b6-65f0-11e5-9d70-feff819cdc9f',
'share_id': 'f0e4bb5e-65f0-11e5-9d70-feff819cdc9f',
'replica_state': 'in_sync',
...
'share_server_id': '07574742-67ea-4dfd-9844-9fbd8ada3d87',
'share_server': <models.ShareServer> or None,
},
...
]
Parameters: | new_replica – The share replica dictionary. |
---|
Example:
{
'id': 'e82ff8b6-65f0-11e5-9d70-feff819cdc9f',
'share_id': 'f0e4bb5e-65f0-11e5-9d70-feff819cdc9f',
'deleted': False,
'host': 'openstack2@cmodeSSVMNFS2',
'status': 'creating',
'scheduled_at': datetime.datetime(2015, 8, 10, 0, 5, 58),
'launched_at': datetime.datetime(2015, 8, 10, 0, 5, 58),
'terminated_at': None,
'replica_state': 'out_of_sync',
'availability_zone_id': 'f6e146d0-65f0-11e5-9d70-feff819cdc9f',
'export_locations': [
models.ShareInstanceExportLocations,
],
'access_rules_status': 'out_of_sync',
'share_network_id': '4ccd5318-65f1-11e5-9d70-feff819cdc9f',
'share_server_id': 'e6155221-ea00-49ef-abf9-9f89b7dd900a',
'share_server': <models.ShareServer> or None,
}
Parameters: | access_rules – A list of access rules. These are rules that other instances of the share already obey. Drivers are expected to apply access rules to the new replica or disregard access rules that don’t apply. |
---|
Example:
[
{
'id': 'f0875f6f-766b-4865-8b41-cccb4cdf1676',
'deleted' = False,
'share_id' = 'f0e4bb5e-65f0-11e5-9d70-feff819cdc9f',
'access_type' = 'ip',
'access_to' = '172.16.20.1',
'access_level' = 'rw',
}
]
Parameters: | replica_snapshots – List of dictionaries of snapshot instances.
This includes snapshot instances of every snapshot of the share
whose ‘aggregate_status’ property was reported to be ‘available’
when the share manager initiated this request. Each list member
will have two sub dictionaries: ‘active_replica_snapshot’ and
‘share_replica_snapshot’. The ‘active’ replica snapshot corresponds
to the instance of the snapshot on any of the ‘active’ replicas of
the share while share_replica_snapshot corresponds to the snapshot
instance for the specific replica that will need to exist on the
new share replica that is being created. The driver needs to ensure
that this snapshot instance is truly available before transitioning
the replica from ‘out_of_sync’ to ‘in_sync’. Snapshots instances
for snapshots that have an ‘aggregate_status’ of ‘creating’ or
‘deleting’ will be polled for in the update_replicated_snapshot
method. |
---|
Example:
[
{
'active_replica_snapshot': {
'id': '8bda791c-7bb6-4e7b-9b64-fefff85ff13e',
'share_instance_id': '10e49c3e-aca9-483b-8c2d-1c337b38d6af',
'status': 'available',
'provider_location': '/newton/share-snapshot-10e49c3e-aca9',
...
},
'share_replica_snapshot': {
'id': '',
'share_instance_id': 'e82ff8b6-65f0-11e5-9d70-feff819cdc9f',
'status': 'available',
'provider_location': None,
...
},
}
]
Parameters: | share_server – <models.ShareServer> or None Share server of the replica being created. |
---|---|
Returns: | None or a dictionary. The dictionary can contain export_locations replica_state and access_rules_status. export_locations is a list of paths and replica_state is one of ‘active’, ‘in_sync’, ‘out_of_sync’ or ‘error’. |
Important
A backend supporting ‘writable’ type replication should return ‘active’ as the replica_state.
Export locations should be in the same format as returned during the
create_share
call.
Example:
{
'export_locations': [
{
'path': '172.16.20.22/sample/export/path',
'is_admin_only': False,
'metadata': {'some_key': 'some_value'},
},
],
'replica_state': 'in_sync',
'access_rules_status': 'in_sync',
}
create_replicated_snapshot
(context, replica_list, replica_snapshots, share_server=None)Create a snapshot on active instance and update across the replicas.
Note
This call is made on the ‘active’ replica’s host. Drivers are expected to transfer the snapshot created to the respective replicas.
The driver is expected to return model updates to the share manager. If it was able to confirm the creation of any number of the snapshot instances passed in this interface, it can set their status to ‘available’ as a cue for the share manager to set the progress attr to ‘100%’.
Parameters: |
|
---|
Example:
[
{
'id': 'd487b88d-e428-4230-a465-a800c2cce5f8',
'share_id': 'f0e4bb5e-65f0-11e5-9d70-feff819cdc9f',
'replica_state': 'in_sync',
...
'share_server_id': '4ce78e7b-0ef6-4730-ac2a-fd2defefbd05',
'share_server': <models.ShareServer> or None,
},
{
'id': '10e49c3e-aca9-483b-8c2d-1c337b38d6af',
'share_id': 'f0e4bb5e-65f0-11e5-9d70-feff819cdc9f',
'replica_state': 'active',
...
'share_server_id': 'f63629b3-e126-4448-bec2-03f788f76094',
'share_server': <models.ShareServer> or None,
},
...
]
Parameters: | replica_snapshots – List of dictionaries of snapshot instances. These snapshot instances track the snapshot across the replicas. All the instances will have their status attribute set to ‘creating’. |
---|
Example:
[
{
'id': 'd3931a93-3984-421e-a9e7-d9f71895450a',
'snapshot_id': '13ee5cb5-fc53-4539-9431-d983b56c5c40',
'status: 'creating',
'progress': '0%',
...
},
{
'id': '8bda791c-7bb6-4e7b-9b64-fefff85ff13e',
'snapshot_id': '13ee5cb5-fc53-4539-9431-d983b56c5c40',
'status: 'creating',
'progress': '0%',
...
},
...
]
Parameters: | share_server – <models.ShareServer> or None |
---|---|
Returns: | List of dictionaries of snapshot instances. The dictionaries can contain values that need to be updated on the database for the snapshot instances being created. |
Raises: | Exception. Any exception in this method will set all instances to ‘error’. |
create_share
(context, share, share_server=None)Is called to create share.
create_share_from_snapshot
(context, share, snapshot, share_server=None)Is called to create share from snapshot.
create_share_group
(context, share_group_dict, share_server=None)Create a share group.
Parameters: |
|
---|---|
Returns: | (share_group_model_update, share_update_list) share_group_model_update - a dict containing any values to be updated for the SG in the database. This value may be None. |
create_share_group_from_share_group_snapshot
(context, share_group_dict, share_group_snapshot_dict, share_server=None)Create a share group from a share group snapshot.
Parameters: |
|
---|---|
Returns: | (share_group_model_update, share_update_list) share_group_model_update - a dict containing any values to be updated for the share group in the database. This value may be None share_update_list - a list of dictionaries containing dicts for every share created in the share group. Any share dicts should at a minimum contain the ‘id’ key and ‘export_locations’. Export locations should be in the same format as returned by a share_create. This list may be empty or None. EXAMPLE: .. code: [{'id': 'uuid', 'export_locations': [{...}, {...}]}]
|
create_share_group_snapshot
(context, snap_dict, share_server=None)Create a share group snapshot.
Parameters: |
|
---|---|
Returns: | (share_group_snapshot_update, member_update_list) share_group_snapshot_update - a dict containing any values to be updated for the CGSnapshot in the database. This value may be None. member_update_list - a list of dictionaries containing for every member of the share group snapshot. Each dict should contains values to be updated for the ShareGroupSnapshotMember in the database. This list may be empty or None. |
create_snapshot
(context, snapshot, share_server=None)Is called to create snapshot.
Parameters: |
|
---|---|
Returns: | None or a dictionary with key ‘export_locations’ containing a list of export locations, if snapshots can be mounted. |
creating_shares_from_snapshots_is_supported
Calculate default value for create_share_from_snapshot_support.
deallocate_network
(context, share_server_id)Deallocate network resources for the given share server.
delete_replica
(context, replica_list, replica_snapshots, replica, share_server=None)Delete a replica.
Note
This call is made on the host that hosts the replica being deleted.
Parameters: |
|
---|
Example:
[
{
'id': 'd487b88d-e428-4230-a465-a800c2cce5f8',
'share_id': 'f0e4bb5e-65f0-11e5-9d70-feff819cdc9f',
'replica_state': 'in_sync',
...
'share_server_id': '4ce78e7b-0ef6-4730-ac2a-fd2defefbd05',
'share_server': <models.ShareServer> or None,
},
{
'id': '10e49c3e-aca9-483b-8c2d-1c337b38d6af',
'share_id': 'f0e4bb5e-65f0-11e5-9d70-feff819cdc9f',
'replica_state': 'active',
...
'share_server_id': 'f63629b3-e126-4448-bec2-03f788f76094',
'share_server': <models.ShareServer> or None,
},
{
'id': 'e82ff8b6-65f0-11e5-9d70-feff819cdc9f',
'share_id': 'f0e4bb5e-65f0-11e5-9d70-feff819cdc9f',
'replica_state': 'in_sync',
...
'share_server_id': '07574742-67ea-4dfd-9844-9fbd8ada3d87',
'share_server': <models.ShareServer> or None,
},
...
]
Parameters: | replica – Dictionary of the share replica being deleted. |
---|
Example:
{
'id': 'e82ff8b6-65f0-11e5-9d70-feff819cdc9f',
'share_id': 'f0e4bb5e-65f0-11e5-9d70-feff819cdc9f',
'deleted': False,
'host': 'openstack2@cmodeSSVMNFS2',
'status': 'available',
'scheduled_at': datetime.datetime(2015, 8, 10, 0, 5, 58),
'launched_at': datetime.datetime(2015, 8, 10, 0, 5, 58),
'terminated_at': None,
'replica_state': 'in_sync',
'availability_zone_id': 'f6e146d0-65f0-11e5-9d70-feff819cdc9f',
'export_locations': [
models.ShareInstanceExportLocations
],
'access_rules_status': 'out_of_sync',
'share_network_id': '4ccd5318-65f1-11e5-9d70-feff819cdc9f',
'share_server_id': '53099868-65f1-11e5-9d70-feff819cdc9f',
'share_server': <models.ShareServer> or None,
}
Parameters: | replica_snapshots – List of dictionaries of snapshot instances. The dict contains snapshot instances that are associated with the share replica being deleted. No model updates to snapshot instances are possible in this method. The driver should return when the cleanup is completed on the backend for both, the snapshots and the replica itself. Drivers must handle situations where the snapshot may not yet have finished ‘creating’ on this replica. |
---|
Example:
[
{
'id': '89dafd00-0999-4d23-8614-13eaa6b02a3b',
'snapshot_id': '3ce1caf7-0945-45fd-a320-714973e949d3',
'status: 'available',
'share_instance_id': 'e82ff8b6-65f0-11e5-9d70-feff819cdc9f'
...
},
{
'id': '8bda791c-7bb6-4e7b-9b64-fefff85ff13e',
'snapshot_id': '13ee5cb5-fc53-4539-9431-d983b56c5c40',
'status: 'creating',
'share_instance_id': 'e82ff8b6-65f0-11e5-9d70-feff819cdc9f'
...
},
...
]
Parameters: | share_server – <models.ShareServer> or None Share server of the replica to be deleted. |
---|---|
Returns: | None. |
Raises: | Exception. Any exception raised will set the share replica’s ‘status’ and ‘replica_state’ attributes to ‘error_deleting’. It will not affect snapshots belonging to this replica. |
delete_replicated_snapshot
(context, replica_list, replica_snapshots, share_server=None)Delete a snapshot by deleting its instances across the replicas.
Note
This call is made on the ‘active’ replica’s host, since drivers may not be able to delete the snapshot from an individual replica.
The driver is expected to return model updates to the share manager. If it was able to confirm the removal of any number of the snapshot instances passed in this interface, it can set their status to ‘deleted’ as a cue for the share manager to clean up that instance from the database.
Parameters: |
|
---|
Example:
[
{
'id': 'd487b88d-e428-4230-a465-a800c2cce5f8',
'share_id': 'f0e4bb5e-65f0-11e5-9d70-feff819cdc9f',
'replica_state': 'in_sync',
...
'share_server_id': '4ce78e7b-0ef6-4730-ac2a-fd2defefbd05',
'share_server': <models.ShareServer> or None,
},
{
'id': '10e49c3e-aca9-483b-8c2d-1c337b38d6af',
'share_id': 'f0e4bb5e-65f0-11e5-9d70-feff819cdc9f',
'replica_state': 'active',
...
'share_server_id': 'f63629b3-e126-4448-bec2-03f788f76094',
'share_server': <models.ShareServer> or None,
},
...
]
Parameters: | replica_snapshots – List of dictionaries of snapshot instances. These snapshot instances track the snapshot across the replicas. All the instances will have their status attribute set to ‘deleting’. |
---|
Example:
[
{
'id': 'd3931a93-3984-421e-a9e7-d9f71895450a',
'snapshot_id': '13ee5cb5-fc53-4539-9431-d983b56c5c40',
'status': 'deleting',
'progress': '100%',
...
},
{
'id': '8bda791c-7bb6-4e7b-9b64-fefff85ff13e',
'snapshot_id': '13ee5cb5-fc53-4539-9431-d983b56c5c40',
'status: 'deleting',
'progress': '100%',
...
},
...
]
Parameters: | share_server – <models.ShareServer> or None |
---|---|
Returns: | List of dictionaries of snapshot instances. The dictionaries can contain values that need to be updated on the database for the snapshot instances being deleted. To confirm the deletion of the snapshot instance, set the ‘status’ attribute of the instance to ‘deleted’ (constants.STATUS_DELETED) |
Raises: | Exception. Any exception in this method will set the status attribute of all snapshot instances to ‘error_deleting’. |
delete_share
(context, share, share_server=None)Is called to remove share.
delete_share_group
(context, share_group_dict, share_server=None)Delete a share group
Parameters: |
|
---|---|
Returns: | share_group_model_update share_group_model_update - a dict containing any values to be updated for the group in the database. This value may be None. |
delete_share_group_snapshot
(context, snap_dict, share_server=None)Delete a share group snapshot
Parameters: |
|
---|---|
Returns: | (share_group_snapshot_update, member_update_list) share_group_snapshot_update - a dict containing any values to be updated for the ShareGroupSnapshot in the database. This value may be None. |
delete_snapshot
(context, snapshot, share_server=None)Is called to remove snapshot.
Parameters: |
|
---|
deny_access
(context, share, access, share_server=None)Deny access to the share.
do_setup
(context)Any initialization the share driver does while starting.
driver_handles_share_servers
ensure_share
(context, share, share_server=None)Invoked to ensure that share is exported.
Driver can use this method to update the list of export locations of the share if it changes. To do that, you should return list with export locations.
Returns: | None or list with export locations |
---|
extend_share
(share, new_size, share_server=None)Extends size of existing share.
Parameters: |
|
---|
get_admin_network_allocations_number
()get_default_filter_function
()Get the default filter_function string.
Each driver could overwrite the method to return a well-known default string if it is available.
Returns: | None |
---|
get_default_goodness_function
()Get the default goodness_function string.
Each driver could overwrite the method to return a well-known default string if it is available.
Returns: | None |
---|
get_filter_function
()Get filter_function string.
Returns either the string from the driver instance or global section in manila.conf. If nothing is specified in manila.conf, then try to find the default filter_function. When None is returned the scheduler will always pass the driver instance.
Returns: | a filter_function string or None |
---|
get_goodness_function
()Get good_function string.
Returns either the string from the driver instance or global section in manila.conf. If nothing is specified in manila.conf, then try to find the default goodness_function. When None is returned the scheduler will give the lowest score to the driver instance.
Returns: | a goodness_function string or None |
---|
get_network_allocations_number
()Returns number of network allocations for creating VIFs.
Drivers that use Nova for share servers should return zero (0) here same as Generic driver does. Because Nova will handle network resources allocation. Drivers that handle networking itself should calculate it according to their own requirements. It can have 1+ network interfaces.
get_periodic_hook_data
(context, share_instances)Dedicated for update/extend of data for existing share instances.
Redefine this method in share driver to be able to update/change/extend share instances data that will be used by periodic hook action. One of possible updates is add-on of “automount” CLI commands for each share instance for case of notification is enabled using ‘hook’ approach.
Parameters: |
|
---|---|
Returns: | list of share instances. |
get_pool
(share)Return pool name where the share resides on.
Parameters: | share – The share hosted by the driver. |
---|
get_share_server_pools
(share_server)Return list of pools related to a particular share server.
Parameters: | share_server – ShareServer class instance. |
---|
get_share_stats
(refresh=False)Get share status.
If ‘refresh’ is True, run update the stats first.
manage_existing
(share, driver_options)Brings an existing share under Manila management.
If the provided share is not valid, then raise a ManageInvalidShare exception, specifying a reason for the failure.
If the provided share is not in a state that can be managed, such as being replicated on the backend, the driver MUST raise ManageInvalidShare exception with an appropriate message.
The share has a share_type, and the driver can inspect that and compare against the properties of the referenced backend share. If they are incompatible, raise a ManageExistingShareTypeMismatch, specifying a reason for the failure.
Parameters: |
|
---|---|
Returns: | share_update dictionary with required key ‘size’, which should contain size of the share. |
manage_existing_snapshot
(snapshot, driver_options)Brings an existing snapshot under Manila management.
If provided snapshot is not valid, then raise a ManageInvalidShareSnapshot exception, specifying a reason for the failure.
Parameters: | snapshot – ShareSnapshotInstance model with ShareSnapshot data. |
---|
Parameters: | driver_options – Optional driver-specific options provided by admin. |
---|
Example:
{
'key': 'value',
...
}
Returns: | model_update dictionary with required key ‘size’, which should contain size of the share snapshot, and key ‘export_locations’ containing a list of export locations, if snapshots can be mounted. |
---|
migration_cancel
(context, source_share, destination_share, source_snapshots, snapshot_mappings, share_server=None, destination_share_server=None)Cancels migration of a given share to another host.
Note
Is called in source share’s backend to cancel migration.
If possible, driver can implement a way to cancel an in-progress migration.
Parameters: |
|
---|
migration_check_compatibility
(context, source_share, destination_share, share_server=None, destination_share_server=None)Checks destination compatibility for migration of a given share.
Note
Is called to test compatibility with destination backend.
Driver should check if it is compatible with destination backend so driver-assisted migration can proceed.
Parameters: |
|
---|---|
Returns: | A dictionary containing values indicating if destination backend is compatible, if share can remain writable during migration, if it can preserve all file metadata and if it can perform migration of given share non-disruptively. Example: {
'compatible': True,
'writable': True,
'preserve_metadata': True,
'nondisruptive': True,
'preserve_snapshots': True,
}
|
migration_complete
(context, source_share, destination_share, source_snapshots, snapshot_mappings, share_server=None, destination_share_server=None)Completes migration of a given share to another host.
Note
Is called in source share’s backend to complete migration.
If driver is implementing 2-phase migration, this method should perform the disruptive tasks related to the 2nd phase of migration, thus completing it. Driver should also delete all original share data from source backend.
Parameters: |
|
---|---|
Returns: | If the migration changes the share export locations, snapshot provider locations or snapshot export locations, this method should return a dictionary with the relevant info. In such case, a dictionary containing a list of export locations and a list of model updates for each snapshot indexed by their IDs. Example: {
'export_locations':
[
{
'path': '1.2.3.4:/foo',
'metadata': {},
'is_admin_only': False
},
{
'path': '5.6.7.8:/foo',
'metadata': {},
'is_admin_only': True
},
],
'snapshot_updates':
{
'bc4e3b28-0832-4168-b688-67fdc3e9d408':
{
'provider_location': '/snapshots/foo/bar_1',
'export_locations':
[
{
'path': '1.2.3.4:/snapshots/foo/bar_1',
'is_admin_only': False,
},
{
'path': '5.6.7.8:/snapshots/foo/bar_1',
'is_admin_only': True,
},
],
},
'2e62b7ea-4e30-445f-bc05-fd523ca62941':
{
'provider_location': '/snapshots/foo/bar_2',
'export_locations':
[
{
'path': '1.2.3.4:/snapshots/foo/bar_2',
'is_admin_only': False,
},
{
'path': '5.6.7.8:/snapshots/foo/bar_2',
'is_admin_only': True,
},
],
},
},
}
|
migration_continue
(context, source_share, destination_share, source_snapshots, snapshot_mappings, share_server=None, destination_share_server=None)Continues migration of a given share to another host.
Note
Is called in source share’s backend to continue migration.
Driver should implement this method to continue monitor the migration progress in storage and perform following steps until 1st phase is completed.
Parameters: |
|
---|---|
Returns: | Boolean value to indicate if 1st phase is finished. |
migration_get_progress
(context, source_share, destination_share, source_snapshots, snapshot_mappings, share_server=None, destination_share_server=None)Obtains progress of migration of a given share to another host.
Note
Is called in source share’s backend to obtain migration progress.
If possible, driver can implement a way to return migration progress information.
Parameters: |
|
---|---|
Returns: | A dictionary with at least ‘total_progress’ field containing the percentage value. |
migration_start
(context, source_share, destination_share, source_snapshots, snapshot_mappings, share_server=None, destination_share_server=None)Starts migration of a given share to another host.
Note
Is called in source share’s backend to start migration.
Driver should implement this method if willing to perform migration in a driver-assisted way, useful for when source share’s backend driver is compatible with destination backend driver. This method should start the migration procedure in the backend and end. Following steps should be done in ‘migration_continue’.
Parameters: |
|
---|
promote_replica
(context, replica_list, replica, access_rules, share_server=None)Promote a replica to ‘active’ replica state.
Note
This call is made on the host that hosts the replica being promoted.
Parameters: |
|
---|
Example:
[
{
'id': 'd487b88d-e428-4230-a465-a800c2cce5f8',
'share_id': 'f0e4bb5e-65f0-11e5-9d70-feff819cdc9f',
'replica_state': 'in_sync',
...
'share_server_id': '4ce78e7b-0ef6-4730-ac2a-fd2defefbd05',
'share_server': <models.ShareServer> or None,
},
{
'id': '10e49c3e-aca9-483b-8c2d-1c337b38d6af',
'share_id': 'f0e4bb5e-65f0-11e5-9d70-feff819cdc9f',
'replica_state': 'active',
...
'share_server_id': 'f63629b3-e126-4448-bec2-03f788f76094',
'share_server': <models.ShareServer> or None,
},
{
'id': 'e82ff8b6-65f0-11e5-9d70-feff819cdc9f',
'share_id': 'f0e4bb5e-65f0-11e5-9d70-feff819cdc9f',
'replica_state': 'in_sync',
...
'share_server_id': '07574742-67ea-4dfd-9844-9fbd8ada3d87',
'share_server': <models.ShareServer> or None,
},
...
]
Parameters: | replica – Dictionary of the replica to be promoted. |
---|
Example:
{
'id': 'e82ff8b6-65f0-11e5-9d70-feff819cdc9f',
'share_id': 'f0e4bb5e-65f0-11e5-9d70-feff819cdc9f',
'deleted': False,
'host': 'openstack2@cmodeSSVMNFS2',
'status': 'available',
'scheduled_at': datetime.datetime(2015, 8, 10, 0, 5, 58),
'launched_at': datetime.datetime(2015, 8, 10, 0, 5, 58),
'terminated_at': None,
'replica_state': 'in_sync',
'availability_zone_id': 'f6e146d0-65f0-11e5-9d70-feff819cdc9f',
'export_locations': [
models.ShareInstanceExportLocations
],
'access_rules_status': 'in_sync',
'share_network_id': '4ccd5318-65f1-11e5-9d70-feff819cdc9f',
'share_server_id': '07574742-67ea-4dfd-9844-9fbd8ada3d87',
'share_server': <models.ShareServer> or None,
}
Parameters: | access_rules – A list of access rules These access rules are obeyed by other instances of the share |
---|
Example:
[
{
'id': 'f0875f6f-766b-4865-8b41-cccb4cdf1676',
'deleted' = False,
'share_id' = 'f0e4bb5e-65f0-11e5-9d70-feff819cdc9f',
'access_type' = 'ip',
'access_to' = '172.16.20.1',
'access_level' = 'rw',
}
]
Parameters: | share_server – <models.ShareServer> or None Share server of the replica to be promoted. |
---|---|
Returns: | updated_replica_list or None. The driver can return the updated list as in the request parameter. Changes that will be updated to the Database are: ‘export_locations’, ‘access_rules_status’ and ‘replica_state’. |
Raises: | Exception. This can be any exception derived from BaseException. This is re-raised by the manager after some necessary cleanup. If the driver raises an exception during promotion, it is assumed that all of the replicas of the share are in an inconsistent state. Recovery is only possible through the periodic update call and/or administrator intervention to correct the ‘status’ of the affected replicas if they become healthy again. |
replication_domain
revert_to_replicated_snapshot
(context, active_replica, replica_list, active_replica_snapshot, replica_snapshots, access_rules, share_server=None)Reverts a replicated share (in place) to the specified snapshot.
Note
This call is made on the ‘active’ replica’s host, since drivers may not be able to revert snapshots on individual replicas.
Does not delete the share snapshot. The share and snapshot must both be ‘available’ for the restore to be attempted. The snapshot must be the most recent one taken by Manila; the API layer performs this check so the driver doesn’t have to.
The share must be reverted in place to the contents of the snapshot. Application admins should quiesce or otherwise prepare the application for the shared file system contents to change suddenly.
Parameters: |
|
---|
revert_to_snapshot
(context, snapshot, access_rules, share_server=None)Reverts a share (in place) to the specified snapshot.
Does not delete the share snapshot. The share and snapshot must both be ‘available’ for the restore to be attempted. The snapshot must be the most recent one taken by Manila; the API layer performs this check so the driver doesn’t have to.
The share must be reverted in place to the contents of the snapshot. Application admins should quiesce or otherwise prepare the application for the shared file system contents to change suddenly.
Parameters: |
|
---|
setup_server
(*args, **kwargs)shrink_share
(share, new_size, share_server=None)Shrinks size of existing share.
If consumed space on share larger than new_size driver should raise ShareShrinkingPossibleDataLoss exception: raise ShareShrinkingPossibleDataLoss(share_id=share[‘id’])
Parameters: |
|
---|
:raises ShareShrinkingPossibleDataLoss, NotImplementedError
snapshot_update_access
(context, snapshot, access_rules, add_rules, delete_rules, share_server=None)Update access rules for given snapshot.
access_rules
contains all access_rules that need to be on the
share. If the driver can make bulk access rule updates, it can
safely ignore the add_rules
and delete_rules
parameters.
If the driver cannot make bulk access rule changes, it can rely on
new rules to be present in add_rules
and rules that need to be
removed to be present in delete_rules
.
When a rule in add_rules
already exists in the back end, drivers
must not raise an exception. When a rule in delete_rules
was never
applied, drivers must not raise an exception, or attempt to set the
rule to error
state.
add_rules
and delete_rules
can be empty lists, in this
situation, drivers should ensure that the rules present in
access_rules
are the same as those on the back end.
Parameters: |
|
---|
snapshots_are_supported
teardown_server
(*args, **kwargs)unmanage
(share)Removes the specified share from Manila management.
Does not delete the underlying backend share.
For most drivers, this will not need to do anything. However, some drivers might use this call as an opportunity to clean up any Manila-specific configuration that they have associated with the backend share.
If provided share cannot be unmanaged, then raise an UnmanageInvalidShare exception, specifying a reason for the failure.
unmanage_snapshot
(snapshot)Removes the specified snapshot from Manila management.
Does not delete the underlying backend share snapshot.
For most drivers, this will not need to do anything. However, some drivers might use this call as an opportunity to clean up any Manila-specific configuration that they have associated with the backend share snapshot.
If provided share snapshot cannot be unmanaged, then raise an UnmanageInvalidShareSnapshot exception, specifying a reason for the failure.
update_access
(context, share, access_rules, add_rules, delete_rules, share_server=None)Update access rules for given share.
access_rules
contains all access_rules that need to be on the
share. If the driver can make bulk access rule updates, it can
safely ignore the add_rules
and delete_rules
parameters.
If the driver cannot make bulk access rule changes, it can rely on
new rules to be present in add_rules
and rules that need to be
removed to be present in delete_rules
.
When a rule in delete_rules
was never applied, drivers must not
raise an exception, or attempt to set the rule to error
state.
add_rules
and delete_rules
can be empty lists, in this
situation, drivers should ensure that the rules present in
access_rules
are the same as those on the back end. One scenario
where this situation is forced is when the access_level is changed for
all existing rules (share migration and for readable replicas).
Drivers must be mindful of this call for share replicas. When
‘update_access’ is called on one of the replicas, the call is likely
propagated to all replicas belonging to the share, especially when
individual rules are added or removed. If a particular access rule
does not make sense to the driver in the context of a given replica,
the driver should be careful to report a correct behavior, and take
meaningful action. For example, if R/W access is requested on a
replica that is part of a “readable” type replication; R/O access
may be added by the driver instead of R/W. Note that raising an
exception will result in the access_rules_status on the replica,
and the share itself being “out_of_sync”. Drivers can sync on the
valid access rules that are provided on the create_replica
and
promote_replica
calls.
Parameters: |
|
---|---|
Returns: | None, or a dictionary of updates in the format: {
} |
The top level keys are ‘access_id’ fields of the access rules that
need to be updated. access_key``s are credentials (str) of the
entities granted access. Any rule in the ``access_rules
parameter
can be updated.
Important
Raising an exception in this method will force all rules in ‘applying’ and ‘denying’ states to ‘error’.
An access rule can be set to ‘error’ state, either explicitly via this return parameter or because of an exception raised in this method. Such an access rule will no longer be sent to the driver on subsequent access rule updates. When users deny that rule however, the driver will be asked to deny access to the client/s represented by the rule. We expect that a rule that was error-ed at the driver should never exist on the back end. So, do not fail the deletion request.
Also, it is possible that the driver may receive a request to add a rule that is already present on the back end. This can happen if the share manager service goes down while the driver is committing access rule changes. Since we cannot determine if the rule was applied successfully by the driver before the disruption, we will treat all ‘applying’ transitional rules as new rules and repeat the request.
update_admin_network_allocation
(context, share_server)Update admin network allocation after share server creation.
update_network_allocation
(context, share_server)Update network allocation after share server creation.
update_replica_state
(context, replica_list, replica, access_rules, replica_snapshots, share_server=None)Update the replica_state of a replica.
Note
This call is made on the host which hosts the replica being updated.
Drivers should fix replication relationships that were broken if possible inside this method.
This method is called periodically by the share manager; and whenever requested by the administrator through the ‘resync’ API.
Parameters: |
|
---|
Example:
[
{
'id': 'd487b88d-e428-4230-a465-a800c2cce5f8',
'share_id': 'f0e4bb5e-65f0-11e5-9d70-feff819cdc9f',
'replica_state': 'in_sync',
...
'share_server_id': '4ce78e7b-0ef6-4730-ac2a-fd2defefbd05',
'share_server': <models.ShareServer> or None,
},
{
'id': '10e49c3e-aca9-483b-8c2d-1c337b38d6af',
'share_id': 'f0e4bb5e-65f0-11e5-9d70-feff819cdc9f',
'replica_state': 'active',
...
'share_server_id': 'f63629b3-e126-4448-bec2-03f788f76094',
'share_server': <models.ShareServer> or None,
},
{
'id': 'e82ff8b6-65f0-11e5-9d70-feff819cdc9f',
'share_id': 'f0e4bb5e-65f0-11e5-9d70-feff819cdc9f',
'replica_state': 'in_sync',
...
'share_server_id': '07574742-67ea-4dfd-9844-9fbd8ada3d87',
'share_server': <models.ShareServer> or None,
},
...
]
Parameters: | replica – Dictionary of the replica being updated Replica state will always be ‘in_sync’, ‘out_of_sync’, or ‘error’. Replicas in ‘active’ state will not be passed via this parameter. |
---|
Example:
{
'id': 'd487b88d-e428-4230-a465-a800c2cce5f8',
'share_id': 'f0e4bb5e-65f0-11e5-9d70-feff819cdc9f',
'deleted': False,
'host': 'openstack2@cmodeSSVMNFS1',
'status': 'available',
'scheduled_at': datetime.datetime(2015, 8, 10, 0, 5, 58),
'launched_at': datetime.datetime(2015, 8, 10, 0, 5, 58),
'terminated_at': None,
'replica_state': 'in_sync',
'availability_zone_id': 'e2c2db5c-cb2f-4697-9966-c06fb200cb80',
'export_locations': [
models.ShareInstanceExportLocations,
],
'access_rules_status': 'in_sync',
'share_network_id': '4ccd5318-65f1-11e5-9d70-feff819cdc9f',
'share_server_id': '4ce78e7b-0ef6-4730-ac2a-fd2defefbd05',
}
Parameters: | access_rules – A list of access rules These access rules are obeyed by other instances of the share. The driver could attempt to sync on any un-applied access_rules. |
---|
Example:
[
{
'id': 'f0875f6f-766b-4865-8b41-cccb4cdf1676',
'deleted' = False,
'share_id' = 'f0e4bb5e-65f0-11e5-9d70-feff819cdc9f',
'access_type' = 'ip',
'access_to' = '172.16.20.1',
'access_level' = 'rw',
}
]
Parameters: | replica_snapshots – List of dictionaries of snapshot instances. This includes snapshot instances of every snapshot of the share whose ‘aggregate_status’ property was reported to be ‘available’ when the share manager initiated this request. Each list member will have two sub dictionaries: ‘active_replica_snapshot’ and ‘share_replica_snapshot’. The ‘active’ replica snapshot corresponds to the instance of the snapshot on any of the ‘active’ replicas of the share while share_replica_snapshot corresponds to the snapshot instance for the specific replica being updated. The driver needs to ensure that this snapshot instance is truly available before transitioning from ‘out_of_sync’ to ‘in_sync’. Snapshots instances for snapshots that have an ‘aggregate_status’ of ‘creating’ or ‘deleting’ will be polled for in the update_replicated_snapshot method. |
---|
Example:
[
{
'active_replica_snapshot': {
'id': '8bda791c-7bb6-4e7b-9b64-fefff85ff13e',
'share_instance_id': '10e49c3e-aca9-483b-8c2d-1c337b38d6af',
'status': 'available',
'provider_location': '/newton/share-snapshot-10e49c3e-aca9',
...
},
'share_replica_snapshot': {
'id': '10e49c3e-aca9-483b-8c2d-1c337b38d6af',
'share_instance_id': 'd487b88d-e428-4230-a465-a800c2cce5f8',
'status': 'creating',
'provider_location': None,
...
},
}
]
Parameters: | share_server – <models.ShareServer> or None |
---|---|
Returns: | replica_state: a str value denoting the replica_state. Valid values are ‘in_sync’ and ‘out_of_sync’ or None (to leave the current replica_state unchanged). |
update_replicated_snapshot
(context, replica_list, share_replica, replica_snapshots, replica_snapshot, share_server=None)Update the status of a snapshot instance that lives on a replica.
Note
For DR and Readable styles of replication, this call is made on the replica’s host and not the ‘active’ replica’s host.
This method is called periodically by the share manager. It will query for snapshot instances that track the parent snapshot across non-‘active’ replicas. Drivers can expect the status of the instance to be ‘creating’ or ‘deleting’. If the driver sees that a snapshot instance has been removed from the replica’s backend and the instance status was set to ‘deleting’, it is expected to raise a SnapshotResourceNotFound exception. All other exceptions will set the snapshot instance status to ‘error’. If the instance was not in ‘deleting’ state, raising a SnapshotResourceNotFound will set the instance status to ‘error’.
Parameters: |
|
---|
Example:
[
{
'id': 'd487b88d-e428-4230-a465-a800c2cce5f8',
'share_id': 'f0e4bb5e-65f0-11e5-9d70-feff819cdc9f',
'replica_state': 'in_sync',
...
'share_server_id': '4ce78e7b-0ef6-4730-ac2a-fd2defefbd05',
'share_server': <models.ShareServer> or None,
},
{
'id': '10e49c3e-aca9-483b-8c2d-1c337b38d6af',
'share_id': 'f0e4bb5e-65f0-11e5-9d70-feff819cdc9f',
'replica_state': 'active',
...
'share_server_id': 'f63629b3-e126-4448-bec2-03f788f76094',
'share_server': <models.ShareServer> or None,
},
...
]
Parameters: | share_replica – Share replica dictionary. This replica is associated with the snapshot instance whose status is being updated. Replicas in ‘active’ replica_state will not be passed via this parameter. |
---|
Example:
{
'id': 'd487b88d-e428-4230-a465-a800c2cce5f8',
'share_id': 'f0e4bb5e-65f0-11e5-9d70-feff819cdc9f',
'deleted': False,
'host': 'openstack2@cmodeSSVMNFS1',
'status': 'available',
'scheduled_at': datetime.datetime(2015, 8, 10, 0, 5, 58),
'launched_at': datetime.datetime(2015, 8, 10, 0, 5, 58),
'terminated_at': None,
'replica_state': 'in_sync',
'availability_zone_id': 'e2c2db5c-cb2f-4697-9966-c06fb200cb80',
'export_locations': [
models.ShareInstanceExportLocations,
],
'access_rules_status': 'in_sync',
'share_network_id': '4ccd5318-65f1-11e5-9d70-feff819cdc9f',
'share_server_id': '4ce78e7b-0ef6-4730-ac2a-fd2defefbd05',
}
Parameters: | replica_snapshots – List of dictionaries of snapshot instances. These snapshot instances track the snapshot across the replicas. This will include the snapshot instance being updated as well. |
---|
Example:
[
{
'id': 'd3931a93-3984-421e-a9e7-d9f71895450a',
'snapshot_id': '13ee5cb5-fc53-4539-9431-d983b56c5c40',
...
},
{
'id': '8bda791c-7bb6-4e7b-9b64-fefff85ff13e',
'snapshot_id': '13ee5cb5-fc53-4539-9431-d983b56c5c40',
...
},
...
]
Parameters: | replica_snapshot – Dictionary of the snapshot instance. This is the instance to be updated. It will be in ‘creating’ or ‘deleting’ state when sent via this parameter. |
---|
Example:
{
'name': 'share-snapshot-18825630-574f-4912-93bb-af4611ef35a2',
'share_id': 'd487b88d-e428-4230-a465-a800c2cce5f8',
'share_name': 'share-d487b88d-e428-4230-a465-a800c2cce5f8',
'status': 'creating',
'id': '18825630-574f-4912-93bb-af4611ef35a2',
'deleted': False,
'created_at': datetime.datetime(2016, 8, 3, 0, 5, 58),
'share': <models.ShareInstance>,
'updated_at': datetime.datetime(2016, 8, 3, 0, 5, 58),
'share_instance_id': 'd487b88d-e428-4230-a465-a800c2cce5f8',
'snapshot_id': '13ee5cb5-fc53-4539-9431-d983b56c5c40',
'progress': '0%',
'deleted_at': None,
'provider_location': None,
}
Parameters: | share_server – <models.ShareServer> or None |
---|---|
Returns: | replica_snapshot_model_update: a dictionary. The dictionary must contain values that need to be updated on the database for the snapshot instance that represents the snapshot on the replica. |
Raises: | exception.SnapshotResourceNotFound Raise this exception for snapshots that are not found on the backend and their status was ‘deleting’. |
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.