Shared Filesystems

Todo

rework

The manila.share.manager Module

NAS share manager managers creating shares and access rights.

Related Flags

share_driver:Used by ShareManager.
class ShareManager(share_driver=None, service_name=None, *args, **kwargs)

Bases: manila.manager.SchedulerDependentManager

Manages NAS storages.

RPC_API_VERSION = '1.6'
allow_access(*args, **kwargs)
create_cgsnapshot(context, cgsnapshot_id)
create_consistency_group(context, cg_id)
create_share_instance(*args, **kwargs)
create_snapshot(*args, **kwargs)
delete_cgsnapshot(context, cgsnapshot_id)
delete_consistency_group(context, cg_id)
delete_free_share_servers(ctxt)
delete_share_instance(*args, **kwargs)
delete_share_server(*args, **kwargs)
delete_snapshot(*args, **kwargs)
deny_access(*args, **kwargs)
extend_share(*args, **kwargs)
get_driver_migration_info(ctxt, share_instance_id, share_server)
get_migration_info(ctxt, share_instance_id, share_server)
init_host(*args, **kwargs)
manage_share(*args, **kwargs)
migrate_share(ctxt, share_id, host, force_host_copy=False)

Migrates a share from current host to another host.

publish_service_capabilities(*args, **kwargs)
shrink_share(*args, **kwargs)
unmanage_share(*args, **kwargs)
add_hooks(f)

The manila.share.driver Module

Drivers for shares.

class ExecuteMixin

Bases: object

Provides an executable functionality to a driver class.

init_execute_mixin(*args, **kwargs)
set_execute(execute)
class GaneshaMixin

Bases: object

Augment derived classes with Ganesha configuration.

init_ganesha_mixin(*args, **kwargs)
class ShareDriver(driver_handles_share_servers, *args, **kwargs)

Bases: object

Class defines interface of NAS driver.

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_cg(context, share_servers, cg_ref, cgsnapshot=None)
choose_share_server_compatible_with_share(context, share_servers, share, snapshot=None, consistency_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:
  • context – Current context
  • share_servers – list with share-server models
  • share – share model
  • snapshot – snapshot model
  • consistency_group – ConsistencyGroup model with shares
Returns:

share-server or None

copy_share_data(context, helper, share, share_instance, share_server, new_share_instance, new_share_server, migration_info_src, migration_info_dest)
create_cgsnapshot(context, snap_dict, share_server=None)

Create a consistency group snapshot.

Parameters:
  • context
  • snap_dict

    The cgsnapshot details EXAMPLE: .. code:

    {
    'status': 'available',
    'project_id': '13c0be6290934bd98596cfa004650049',
    'user_id': 'a0314a441ca842019b0952224aa39192',
    'description': None,
    'deleted': '0',
    'created_at': datetime.datetime(2015, 8, 10, 0, 5, 58),
    'updated_at': datetime.datetime(2015, 8, 10, 0, 5, 58),
    'consistency_group_id': '4b04fdc3-00b9-4909-ba1a-06e9b3f88b67',
    'cgsnapshot_members': [
        {
         'status': 'available',
         'share_type_id': '1a9ed31e-ee70-483d-93ba-89690e028d7f',
         'user_id': 'a0314a441ca842019b0952224aa39192',
         'deleted': 'False',
         'created_at': datetime.datetime(2015, 8, 10, 0, 5, 58),
         'share': <models.Share>,
         'updated_at': datetime.datetime(2015, 8, 10, 0, 5, 58),
         'share_proto': 'NFS',
         'project_id': '13c0be6290934bd98596cfa004650049',
         'cgsnapshot_id': 'f6aa3b59-57eb-421e-965c-4e182538e36a',
         'deleted_at': None,
         'id': '6813e06b-a8f5-4784-b17d-f3e91afa370e',
         'size': 1
        }
    ],
    'deleted_at': None,
    'id': 'f6aa3b59-57eb-421e-965c-4e182538e36a',
    'name': None
    }
    
Returns:

(cgsnapshot_update, member_update_list) cgsnapshot_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 cgsnapshot. Each dict should contains values to be updated for teh CGSnapshotMember in the database. This list may be empty or None.

create_consistency_group(context, cg_dict, share_server=None)

Create a consistency group.

Parameters:
  • context
  • cg_dict – The consistency group details EXAMPLE: { ‘status’: ‘creating’, ‘project_id’: ‘13c0be6290934bd98596cfa004650049’, ‘user_id’: ‘a0314a441ca842019b0952224aa39192’, ‘description’: None, ‘deleted’: ‘False’, ‘created_at’: datetime.datetime(2015, 8, 10, 15, 14, 6), ‘updated_at’: None, ‘source_cgsnapshot_id’: ‘f6aa3b59-57eb-421e-965c-4e182538e36a’, ‘host’: 'openstack2@cmodeSSVMNFS‘, ‘deleted_at’: None, ‘share_types’: [<models.ConsistencyGroupShareTypeMapping>], ‘id’: ‘eda52174-0442-476d-9694-a58327466c14’, ‘name’: None }
Returns:

(cg_model_update, share_update_list) cg_model_update - a dict containing any values to be updated for the CG in the database. This value may be None.

create_consistency_group_from_cgsnapshot(context, cg_dict, cgsnapshot_dict, share_server=None)

Create a consistency group from a cgsnapshot.

Parameters:
  • context
  • cg_dict

    The consistency group details EXAMPLE: .. code:

    {
    'status': 'creating',
    'project_id': '13c0be6290934bd98596cfa004650049',
    'user_id': 'a0314a441ca842019b0952224aa39192',
    'description': None,
    'deleted': 'False',
    'created_at': datetime.datetime(2015, 8, 10, 15, 14, 6),
    'updated_at': None,
    'source_cgsnapshot_id': 'f6aa3b59-57eb-421e-965c-4e182538e36a',
    'host': 'openstack2@cmodeSSVMNFS',
    'deleted_at': None,
    'shares': [<models.Share>], # The new shares being created
    'share_types': [<models.ConsistencyGroupShareTypeMapping>],
    'id': 'eda52174-0442-476d-9694-a58327466c14',
    'name': None
    }
    
  • cgsnapshot_dict

    The cgsnapshot details EXAMPLE: .. code:

    {
    'status': 'available',
    'project_id': '13c0be6290934bd98596cfa004650049',
    'user_id': 'a0314a441ca842019b0952224aa39192',
    'description': None,
    'deleted': '0',
    'created_at': datetime.datetime(2015, 8, 10, 0, 5, 58),
    'updated_at': datetime.datetime(2015, 8, 10, 0, 5, 58),
    'consistency_group_id': '4b04fdc3-00b9-4909-ba1a-06e9b3f88b67',
    'cgsnapshot_members': [
        {
         'status': 'available',
         'share_type_id': '1a9ed31e-ee70-483d-93ba-89690e028d7f',
         'user_id': 'a0314a441ca842019b0952224aa39192',
         'deleted': 'False',
         'created_at': datetime.datetime(2015, 8, 10, 0, 5, 58),
         'share': <models.Share>,
         'updated_at': datetime.datetime(2015, 8, 10, 0, 5, 58),
         'share_proto': 'NFS',
         'project_id': '13c0be6290934bd98596cfa004650049',
         'cgsnapshot_id': 'f6aa3b59-57eb-421e-965c-4e182538e36a',
         'deleted_at': None,
         'id': '6813e06b-a8f5-4784-b17d-f3e91afa370e',
         'size': 1
        }
    ],
    'deleted_at': None,
    'id': 'f6aa3b59-57eb-421e-965c-4e182538e36a',
    'name': None
    }
    
Returns:

(cg_model_update, share_update_list) cg_model_update - a dict containing any values to be updated for the CG in the database. This value may be None.

share_update_list - a list of dictionaries containing dicts for every share created in the CG. 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': ['export_path']}]

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_snapshot(context, snapshot, share_server=None)

Is called to create snapshot.

Parameters:
  • context – Current context
  • snapshot – Snapshot model. Share model could be retrieved through snapshot[‘share’].
  • share_server – Share server model or None.
deallocate_network(context, share_server_id)

Deallocate network resources for the given share server.

delete_cgsnapshot(context, snap_dict, share_server=None)

Delete a consistency group snapshot

Parameters:
  • context
  • snap_dict

    The cgsnapshot details EXAMPLE: .. code:

    {
    'status': 'available',
    'project_id': '13c0be6290934bd98596cfa004650049',
    'user_id': 'a0314a441ca842019b0952224aa39192',
    'description': None,
    'deleted': '0',
    'created_at': datetime.datetime(2015, 8, 10, 0, 5, 58),
    'updated_at': datetime.datetime(2015, 8, 10, 0, 5, 58),
    'consistency_group_id': '4b04fdc3-00b9-4909-ba1a-06e9b3f88b67',
    'cgsnapshot_members': [
        {
         'status': 'available',
         'share_type_id': '1a9ed31e-ee70-483d-93ba-89690e028d7f',
         'share_id': 'e14b5174-e534-4f35-bc4f-fe81c1575d6f',
         'user_id': 'a0314a441ca842019b0952224aa39192',
         'deleted': 'False',
         'created_at': datetime.datetime(2015, 8, 10, 0, 5, 58),
         'share': <models.Share>,
         'updated_at': datetime.datetime(2015, 8, 10, 0, 5, 58),
         'share_proto': 'NFS',
         'project_id': '13c0be6290934bd98596cfa004650049',
         'cgsnapshot_id': 'f6aa3b59-57eb-421e-965c-4e182538e36a',
         'deleted_at': None,
         'id': '6813e06b-a8f5-4784-b17d-f3e91afa370e',
         'size': 1
        }
    ],
    'deleted_at': None,
    'id': 'f6aa3b59-57eb-421e-965c-4e182538e36a',
    'name': None
    }
    
Returns:

(cgsnapshot_update, member_update_list) cgsnapshot_update - a dict containing any values to be updated for the CGSnapshot in the database. This value may be None.

delete_consistency_group(context, cg_dict, share_server=None)

Delete a consistency group

Parameters:
  • context – The request context
  • cg_dict

    The consistency group details EXAMPLE: .. code:

    {
    'status': 'creating',
    'project_id': '13c0be6290934bd98596cfa004650049',
    'user_id': 'a0314a441ca842019b0952224aa39192',
    'description': None,
    'deleted': 'False',
    'created_at': datetime.datetime(2015, 8, 10, 15, 14, 6),
    'updated_at': None,
    'source_cgsnapshot_id': 'f6aa3b59-57eb-421e-965c-4e182538e36a',
    'host': 'openstack2@cmodeSSVMNFS',
    'deleted_at': None,
    'shares': [<models.Share>], # The new shares being created
    'share_types': [<models.ConsistencyGroupShareTypeMapping>],
    'id': 'eda52174-0442-476d-9694-a58327466c14',
    'name': None
    }
    
Returns:

cg_model_update cg_model_update - a dict containing any values to be updated for the CG in the database. This value may be None.

delete_share(context, share, share_server=None)

Is called to remove share.

delete_snapshot(context, snapshot, share_server=None)

Is called to remove snapshot.

Parameters:
  • context – Current context
  • snapshot – Snapshot model. Share model could be retrieved through snapshot[‘share’].
  • share_server – Share server model or None.
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.

:return None or list with export locations

extend_share(share, new_size, share_server=None)

Extends size of existing share.

Parameters:
  • share – Share model
  • new_size – New size of share (new_size > share[‘size’])
  • share_server – Optional – Share server model
get_driver_migration_info(context, share_instance, share_server)

Is called to provide necessary driver migration logic.

get_migration_info(context, share_instance, share_server)

Is called to provide necessary generic migration logic.

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:
  • context – Current context
  • share_instances – share instances list provided by share manager
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 provided share is not valid, then raise a ManageInvalidShare exception, specifying a reason for the failure.

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:
  • share – Share model
  • driver_options – Driver-specific options provided by admin.
Returns:

share_update dictionary with required key ‘size’, which should contain size of the share.

migrate_share(context, share_ref, host, dest_driver_migration_info)

Is called to perform driver migration.

Driver should implement this method if willing to perform migration in an optimized way, useful for when driver understands destination backend. :param context: The ‘context.RequestContext’ object for the request. :param share_ref: Reference to the share being migrated. :param host: Destination host and its capabilities. :param dest_driver_migration_info: Migration information provided by destination host. :returns: Boolean value indicating if driver migration succeeded. :returns: Dictionary containing a model update.

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:
  • share – Share model
  • new_size – New size of share (new_size < share[‘size’])
  • share_server – Optional – Share server model

:raises ShareShrinkingPossibleDataLoss, NotImplementedError

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.

Table Of Contents

Previous topic

The Database Layer

Next topic

Authentication and Authorization

Project Source

This Page