ZFS (on Linux) Driver
Manila ZFSonLinux share driver uses ZFS filesystem for exporting NFS shares.
Written and tested using Linux version of ZFS.
Requirements
‘NFS’ daemon that can be handled via “exportfs” app.
‘ZFS’ filesystem packages, either Kernel or FUSE versions.
ZFS zpools that are going to be used by Manila should exist and be
configured as desired. Manila will not change zpool configuration.
For remote ZFS hosts according to manila-share service host SSH should be
installed.
- For ZFS hosts that support replication:
- SSH access for each other should be passwordless.
- IP used for share exports should be available by ZFS hosts for each other.
- Username should be the same for accessing each of ZFS hosts.
Supported Operations
The following operations are supported:
Possibilities
- Any amount of ZFS zpools can be used by share driver.
- Allowed to configure default options for ZFS datasets that are used
for share creation.
- Any amount of nested datasets is allowed to be used.
- All share replicas are read-only, only active one is RW.
- All share replicas are synchronized periodically, not continuously.
So, status ‘in_sync’ means latest sync was successful.
Time range between syncs equals to value of
config global opt ‘replica_state_update_interval’.
Restrictions
The ZFSonLinux share driver has the following restrictions:
- Only IP access type is supported for NFS.
- Only FLAT network is supported.
- ‘Promote share replica’ operation will switch roles of
current ‘secondary’ replica and ‘active’. It does not make more than
one active replica available.
- ‘Manage share’ operation is not yet implemented.
- ‘SaMBa’ based sharing is not yet implemented.
Known problems
- Better to avoid usage of Neutron on the same node where ZFS is installed.
It leads to bug - https://bugs.launchpad.net/neutron/+bug/1546723
The ZFSonLinux share driver has workaround for it and requires ‘nsenter’ be
installed on the system where ZFS is installed.
- ‘Promote share replica’ operation will make ZFS filesystem that became
secondary as RO only on NFS level. On ZFS level system will
stay mounted as was - RW.
Backend Configuration
The following parameters need to be configured in the manila configuration file
for the ZFSonLinux driver:
share_driver = manila.share.drivers.zfsonlinux.driver.ZFSonLinuxShareDriver
driver_handles_share_servers = False
- replication_domain = custom_str_value_as_domain_name
- if empty, then replication will be disabled
- if set then will be able to be used as replication peer for other
backend with same value.
zfs_share_export_ip = <user_facing IP address of ZFS host>
zfs_service_ip = <IP address of service network interface of ZFS host>
- zfs_zpool_list = zpoolname1,zpoolname2/nested_dataset_for_zpool2
- can be one or more zpools
- can contain nested datasets
- zfs_dataset_creation_options = <list of ZFS dataset options>
- readonly,quota,sharenfs and sharesmb options will be ignored
- zfs_dataset_name_prefix = <prefix>
- Prefix to be used in each dataset name.
- zfs_dataset_snapshot_name_prefix = <prefix>
- Prefix to be used in each dataset snapshot name.
- zfs_use_ssh = <boolean_value>
- set ‘False’ if ZFS located on the same host as ‘manila-share’ service
- set ‘True’ if ‘manila-share’ service should use SSH for ZFS configuration
- zfs_ssh_username = <ssh_username>
- required for replication operations
- required for SSH’ing to ZFS host if ‘zfs_use_ssh’ is set to ‘True’
- zfs_ssh_user_password = <ssh_user_password>
- password for ‘zfs_ssh_username’ of ZFS host.
- used only if ‘zfs_use_ssh’ is set to ‘True’
- zfs_ssh_private_key_path = <path_to_private_ssh_key>
- used only if ‘zfs_use_ssh’ is set to ‘True’
- zfs_share_helpers = NFS=manila.share.drivers.zfsonlinux.utils.NFSviaZFSHelper
- Approach for setting up helpers is similar to various other share driver
- At least one helper should be used.
- zfs_replica_snapshot_prefix = <prefix>
- Prefix to be used in dataset snapshot names that are created
by ‘update replica’ operation.
Restart of manila-share service is needed for the configuration
changes to take effect.
The manila.share.drivers.zfsonlinux.driver Module
Module with ZFSonLinux share driver that utilizes ZFS filesystem resources
and exports them as shares.
-
class ZFSonLinuxShareDriver(*args, **kwargs)
Bases: manila.share.drivers.zfsonlinux.utils.ExecuteMixin, manila.share.driver.ShareDriver
-
create_replica(context, *args, **kwargs)
-
create_replicated_snapshot(context, *args, **kwargs)
-
create_share(context, *args, **kwargs)
-
create_share_from_snapshot(context, *args, **kwargs)
-
create_snapshot(context, *args, **kwargs)
-
delete_replica(context, *args, **kwargs)
-
delete_replicated_snapshot(context, *args, **kwargs)
-
delete_share(context, *args, **kwargs)
-
delete_snapshot(context, *args, **kwargs)
-
do_setup(context)
Perform basic setup and checks.
-
ensure_share(context, *args, **kwargs)
-
extend_share(context, *args, **kwargs)
-
get_network_allocations_number()
ZFS does not handle networking. Return 0.
-
get_pool(share)
Return pool name where the share resides on.
Parameters: | share – The share hosted by the driver. |
-
promote_replica(context, *args, **kwargs)
-
shrink_share(context, *args, **kwargs)
-
unmanage(share)
Removes the specified share from Manila management.
-
update_access(context, *args, **kwargs)
-
update_replica_state(context, *args, **kwargs)
-
update_replicated_snapshot(context, *args, **kwargs)
-
ensure_share_server_not_provided(f)
The manila.share.drivers.zfsonlinux.utils Module
- Module for storing ZFSonLinux driver utility stuff such as:
- Common ZFS code
- Share helpers
-
class ExecuteMixin
Bases: manila.share.driver.ExecuteMixin
-
execute(*cmd, **kwargs)
Common interface for running shell commands.
-
execute_with_retry(*args, **kwargs)
Retry wrapper over common shell interface.
-
get_zfs_option(dataset_name, option_name)
Returns value of requested zfs dataset option.
-
get_zpool_option(zpool_name, option_name)
Returns value of requested zpool option.
-
init_execute_mixin(*args, **kwargs)
Init method for mixin called in the end of driver’s __init__().
-
parse_zfs_answer(string)
Returns list of dicts with data returned by ZFS shell commands.
-
zfs(*cmd, **kwargs)
ZFS shell commands executor.
-
class NASHelperBase(configuration)
Bases: object
Base class for share helpers of ‘ZFS on Linux’ driver.
-
create_exports(dataset_name)
Creates share exports.
-
get_exports(dataset_name, service)
Gets/reads share exports.
-
remove_exports(dataset_name)
Removes share exports.
-
update_access(dataset_name, access_rules, add_rules, delete_rules)
Update access rules for specified ZFS dataset.
-
verify_setup()
Performs checks for required stuff.
-
class NFSviaZFSHelper(configuration)
Bases: manila.share.drivers.zfsonlinux.utils.ExecuteMixin, manila.share.drivers.zfsonlinux.utils.NASHelperBase
Helper class for handling ZFS datasets as NFS shares.
Kernel and Fuse versions of ZFS have different syntax for setting up access
rules, and this Helper designed to satisfy both making autodetection.
-
create_exports(dataset_name)
Creates NFS share exports for given ZFS dataset.
-
get_exports(dataset_name)
Gets/reads NFS share export for given ZFS dataset.
-
is_kernel_version
Says whether Kernel version of ZFS is used or not.
-
remove_exports(*args, **kwargs)
-
update_access(*args, **kwargs)
-
verify_setup()
Performs checks for required stuff.
-
zfs_dataset_synchronized(f)