Generic approach for share provisioning
The Manila Shared Filesystem Management Service can be configured to use Nova
VMs and Cinder volumes. There are two modules that handle them in Manila:
1) ‘service_instance’ module creates VMs in Nova with predefined image called
service image. This module can be used by any backend driver for provisioning
of service VMs to be able to separate share resources among tenants.
2) ‘generic’ module operates with Cinder volumes and VMs created by
‘service_instance’ module, then creates shared filesystems based on volumes
attached to VMs.
Network configurations
Each backend driver can handle networking in its own way,
see: https://wiki.openstack.org/wiki/Manila/Networking
- One of two possible configurations can be chosen for share provisioning
- using ‘service_instance’ module:
- Service VM has one net interface from net that is connected to public router.
For successful creation of share, user network should be connected to public
router too.
- Service VM has two net interfaces, first one connected to service network,
second one connected directly to user’s network.
Requirements for service image
Linux based distro
NFS server
Samba server >=3.2.0, that can be configured by data stored in registry
SSH server
Two net interfaces configured to DHCP (see network approaches)
‘exportfs’ and ‘net conf’ libraries used for share actions
- Following files will be used, so if their paths differ one needs to create at
least symlinks for them:
- /etc/exports (permanent file with NFS exports)
- /var/lib/nfs/etab (temporary file with NFS exports used by ‘exportfs’)
- /etc/fstab (permanent file with mounted filesystems)
- /etc/mtab (temporary file with mounted filesystems used by ‘mount’)
Supported shared filesystems
- NFS (access by IP)
- CIFS (access by IP)
Known restrictions
- One of Nova’s configurations only allows 26 shares per server. This limit
comes from the maximum number of virtual PCI interfaces that are used for
block device attaching. There are 28 virtual PCI interfaces, in this
configuration, two of them are used for server needs and other 26 are used
for attaching block devices that are used for shares.
- Juno version works only with Neutron. Each share should be created with
neutron-net and neutron-subnet IDs provided via share-network entity.
- Juno version handles security group, flavor, image, keypair for Nova VM and
also creates service networks, but does not use availability zones for
Nova VMs and volume types for Cinder block devices.
The manila.share.drivers.generic Module
Generic Driver for shares.
-
class CIFSHelper(execute, ssh_execute, config_object)
Bases: manila.share.drivers.generic.NASHelperBase
Manage shares in samba server by net conf tool.
Class provides functionality to operate with CIFS shares.
Samba server should be configured to use registry as configuration
backend to allow dynamically share managements.
-
CIFSHelper.allow_access(server, share_name, access_type, access)
Add access for share.
-
CIFSHelper.create_export(server, share_name, recreate=False)
Create share at samba server.
-
CIFSHelper.deny_access(server, share_name, access_type, access, force=False)
Remove access for share.
-
CIFSHelper.init_helper(server)
-
CIFSHelper.remove_export(server, share_name)
Remove share definition from samba server.
-
class GenericShareDriver(db, *args, **kwargs)
Bases: manila.share.driver.ExecuteMixin, manila.share.driver.ShareDriver
Executes commands relating to Shares.
-
GenericShareDriver.allow_access(*args, **kwargs)
-
GenericShareDriver.check_for_setup_error()
Returns an error if prerequisites aren’t met.
-
GenericShareDriver.create_share(*args, **kwargs)
-
GenericShareDriver.create_share_from_snapshot(*args, **kwargs)
-
GenericShareDriver.create_snapshot(*args, **kwargs)
-
GenericShareDriver.delete_share(*args, **kwargs)
-
GenericShareDriver.delete_snapshot(*args, **kwargs)
-
GenericShareDriver.deny_access(*args, **kwargs)
-
GenericShareDriver.do_setup(context)
Any initialization the generic driver does while starting.
-
GenericShareDriver.ensure_share(*args, **kwargs)
-
GenericShareDriver.get_network_allocations_number()
Get number of network interfaces to be created.
-
GenericShareDriver.get_share_stats(refresh=False)
Get share status.
If ‘refresh’ is True, run update the stats first.
-
GenericShareDriver.setup_server(network_info, metadata=None)
-
GenericShareDriver.teardown_server(server_details, security_services=None)
-
class NASHelperBase(execute, ssh_execute, config_object)
Bases: object
Interface to work with share.
-
NASHelperBase.allow_access(server, share_name, access_type, access)
Allow access to the host.
-
NASHelperBase.create_export(server, share_name, recreate=False)
Create new export, delete old one if exists.
-
NASHelperBase.deny_access(local_path, share_name, access_type, access, force=False)
Deny access to the host.
-
NASHelperBase.init_helper(server)
-
NASHelperBase.remove_export(server, share_name)
Remove export.
-
class NFSHelper(execute, ssh_execute, config_object)
Bases: manila.share.drivers.generic.NASHelperBase
Interface to work with share.
-
NFSHelper.allow_access(*args, **kwargs)
-
NFSHelper.create_export(server, share_name, recreate=False)
Create new export, delete old one if exists.
-
NFSHelper.deny_access(*args, **kwargs)
-
NFSHelper.init_helper(server)
-
NFSHelper.remove_export(server, share_name)
Remove export.
-
ensure_server(f)
-
nfs_synchronized(f)
The manila.share.drivers.service_instance Module
Module for managing nova instances for share drivers.
-
class ServiceInstanceManager(db, *args, **kwargs)
Bases: object
Manages nova instances for various share drivers.
This class provides two external methods:
1. set_up_service_instance: creates instance and sets up share
infrastructure
ensure_service_instance: ensure service instance is available.
- delete_service_instance: removes service instance and network
infrastructure.
-
ServiceInstanceManager.delete_service_instance(context, instance_id, subnet_id, router_id)
Removes share infrastructure.
Deletes service vm and subnet, associated to share network.
-
ServiceInstanceManager.ensure_service_instance(context, server)
Ensures that server exists and active.
-
ServiceInstanceManager.get_config_option(key)
Returns value of config option.
Parameters: | key – key of config’ option. |
Returns: | str – value of config’s option.
first priority is driver’s config,
second priority is global config. |
-
ServiceInstanceManager.set_up_service_instance(context, instance_name, neutron_net_id, neutron_subnet_id)
Finds or creates and sets up service vm.
Parameters: |
- context – defines context, that should be used
- instance_name – provides name for service VM
- neutron_net_id – provides network id for service VM
- neutron_subnet_id – provides subnet id for service VM
|
Returns: | dict with service instance details
|
Raises : | exception.ServiceInstanceException
|