GlusterFS 驱动

GlusterFS 驱动使用 GlusterFS,一个开源分布式文件系统,作为存储后端,为 manila 客户端提供文件共享。

注意

此驱动程序已在 18.0.0 版本中弃用。

支持的共享文件系统

  • NFS(通过 IP 访问)

支持的操作

  • 创建 share

  • 删除共享

  • 允许共享访问 (rw)

  • 拒绝共享访问

  • 使用卷布局

    • 创建快照

    • 删除快照

    • 从快照创建共享

需求

  • 在存储后端安装 glusterfs-server 包,版本 >= 3.5.x。

  • 如果使用 NFS-Ganesha 作为 GlusterFS 后端的 NFS 服务器,请安装 NFS-Ganesha,版本 >=2.1。

  • 在 manila 主机上安装 glusterfs 和 glusterfs-fuse 包,版本 >=3.5.x。

  • 建立 manila 宿主机与存储后端之间的网络连接。

Manila 驱动程序配置设置

manila 的配置文件中需要设置以下参数

  • share_driver = manila.share.drivers.glusterfs.GlusterfsShareDriver

以下配置参数是可选的

  • glusterfs_nfs_server_type = <GlusterFS 使用的 NFS 服务器类型

    后端,GlusterGaneshaGluster 是默认类型>

  • glusterfs_share_layout = <使用的共享布局>; 参见 布局

  • glusterfs_path_to_private_key = <manila 主机的私钥文件路径>

  • glusterfs_server_password = <远程 GlusterFS 服务器机器的密码>

如果使用 Ganesha NFS 服务器 (glusterfs_nfs_server_type = Ganesha),则默认情况下 Ganesha 服务器应该在 manila 主机上运行,并通过本地命令进行管理。如果它部署在其他地方,则通过 ssh 进行管理,可以通过以下参数进行配置

  • glusterfs_ganesha_server_ip

  • glusterfs_ganesha_server_username

  • glusterfs_ganesha_server_password

如果没有 glusterfs_ganesha_server_password,ssh 访问将回退到基于密钥的身份验证,使用 glusterfs_path_to_private_key 指定的密钥,或者,如果没有该密钥,则使用位于 OpenSSH 样式的默认密钥位置之一 (~/.ssh/id_{r,d,ecd}sa)。

布局也有其自己的一组参数,请参阅 布局 了解详情。

布局

Liberty 版本中新增,可以使用多个共享布局与 glusterfs 驱动程序。布局是一种从 GlusterFS 后端为共享分配存储的策略。目前已实现两种布局

  • 目录映射布局 (或 目录布局,或简称 dir 布局):共享由给定 GlusterFS 卷的顶级子目录支持。

    目录映射布局是默认布局,并且与 Kilo 兼容。以下设置明确指定其用法:glusterfs_share_layout = layout_directory.GlusterfsDirectoryMappedLayout

    选项

    • glusterfs_target:托管目录的卷的地址。如果格式为 <glustervolserver>:/<glustervolid>,则预计 manila 主机是该卷的 GlusterFS 集群的一部分,并且 GlusterFS 管理通过本地调用 gluster 实用程序进行。如果格式为 <username>@<glustervolserver>:/<glustervolid>,则我们 ssh 到 <username>@<glustervolserver> 来执行 gluster (<username> 应该具有 <glustervolserver> 上的管理权限)。

    • glusterfs_mount_point_base = <GlusterFS 卷在

      manila 主机上挂载的基本路径> (可选;默认为 $state_path/mnt,其中 $state_path 默认为 /var/lib/manila)

    Limitations

    • 目录布局不支持快照操作。

  • 卷映射布局 (或 卷布局,或简称 vol 布局):共享由整个 GlusterFS 卷支持。

    卷映射布局是 Liberty 版本中新增的。可以通过设置 glusterfs_share_layout = layout_volume.GlusterfsVolumeMappedLayout 来选择它。

    选项 (必需)

    • glusterfs_servers

    • glusterfs_volume_pattern

    卷映射布局是 glusterfs 和 glusterfs-native 驱动程序的通用后端;请参阅 GlusterFS Native 驱动程序 中这些选项的描述:Manila 驱动程序配置设置

Gluster NFS 与卷映射布局

一种特殊的配置选择是

glusterfs_nfs_server_type = Gluster
glusterfs_share_layout = layout_volume.GlusterfsVolumeMappedLayout

即,使用 Gluster NFS 导出整个卷。

所有其他 GlusterFS 后端配置(包括使用 glusterfs-native 设置的 GlusterFS)都需要 nfs.export-volumes = off GlusterFS 设置。Gluster NFS 与卷布局需要 nfs.export-volumes = onnfs.export-volumes 是一个集群范围设置,因此给定的 GlusterFS 集群不能同时托管使用 Gluster NFS + 卷布局和其它共享后端配置的共享后端。

关于 nfs.export-volumes 还有另一个注意事项:在没有足够注意的情况下将其设置为 on 存在安全风险,因为卷导出的默认访问控制是“允许所有”。因此,虽然 manila 会为所有其他共享后端配置自动设置 nfs.export-volumes = off 设置,但在 Gluster NFS 与卷布局设置的情况下,manila 不会设置 nfs.export-volumes = on。它留给 GlusterFS 管理员与相关的安全措施一起进行此设置(即,对于集群中未被 manila 使用的那些卷,必须通过 nfs.rpc-auth-{allow,reject} 选项手动配置访问限制)。

已知限制

  • 该驱动程序不支持网络分段的多租户模型,而是使用扁平网络,其中租户共享网络。

  • 如果 NFS Ganesha 是 GlusterFS 后端使用的 NFS 服务器,则可以通过 NFSv3 和 v4 协议访问共享。但是,如果 GlusterFS 后端使用 Gluster NFS,则只能通过 NFSv3 协议访问共享。

  • 所有 manila 共享,映射到 GlusterFS 卷内的子目录,当前都创建在 GlusterFS 存储池的单个 GlusterFS 卷内。

  • 该驱动程序不支持共享的只读访问级别。

  • 假设共享 S 通过 Gluster NFS 导出,并且租户机器 T 已经挂载了 S。如果此时通过 access-deny 撤销 T 对 S 的访问,那么预先存在的挂载仍然可用,并且 T 仍然可以访问 S 中的数据,只要该挂载存在。(这违反了拒绝访问应始终导致立即失去对共享的访问权限的原则,请参阅 http://lists.openstack.org/pipermail/openstack-dev/2015-July/069109.html。)

The manila.share.drivers.glusterfs 模块

扁平网络 GlusterFS 驱动程序。

Manila 共享是 GlusterFS 卷内的子目录。后端,一个 GlusterFS 集群,使用两种 NFS 服务器之一,Gluster-NFS 或 NFS-Ganesha,基于配置选项来调解对共享的访问。NFS-Ganesha 服务器支持 NFSv3 和 v4 协议,而 Gluster-NFS 服务器仅支持 NFSv3 协议。

TODO(rraja):支持 SMB 协议。

class GaneshaNFSHelper(execute, config_object, **kwargs)

基于 GaneshaNASHelper

get_export(share)
init_helper()

初始化特定协议的 NAS 驱动程序。

shared_data = {}
update_access(base_path, share, add_rules, delete_rules, recovery=False)

更新访问规则。

class GlusterNFSHelper(execute, config_object, **kwargs)

基类: NASHelperBase

使用 Gluster-NFS 服务器管理共享。

get_export(share)
supported_access_levels = ('rw',)
supported_access_types = ('ip',)
update_access(base_path, share, add_rules, delete_rules, recovery=False)

更新访问规则。

class GlusterNFSVolHelper(execute, config_object, **kwargs)

基于 GlusterNFSHelper

使用 Gluster-NFS 服务器管理共享,卷映射变体。

update_access(base_path, share, add_rules, delete_rules, recovery=False)

更新访问规则。

class GlusterfsShareDriver(*args, **kwargs)

基于 ExecuteMixin, GaneshaMixin, GlusterfsShareDriverBase

执行与共享相关的命令。

GLUSTERFS_VERSION_MIN = (3, 5)
check_for_setup_error()

检查设置错误。

do_setup(context)

共享驱动程序启动时执行的任何初始化。

get_network_allocations_number()

返回创建 VIF 的网络分配数量。

使用 Nova 进行共享服务器的驱动程序应在此处返回零 (0),就像通用驱动程序一样。因为 Nova 将处理网络资源分配。自行处理网络的驱动程序应根据自己的要求进行计算。它可以有 1 个或多个网络接口。

property supported_access_levels
property supported_access_types
supported_layouts = ('layout_directory.GlusterfsDirectoryMappedLayout', 'layout_volume.GlusterfsVolumeMappedLayout')
supported_protocols = ('NFS',)