Show Table of Contents
6.7. 配置 NFS 存储
本节介绍了配置 Overcloud 来使用 NFS 共享的方法。整个安装和配置的过程基于对核心 Heat 模板中的一个环境文件的修改。
在
/usr/share/openstack-tripleo-heat-templates/environments/ 中,核心 heat 模板集合包括了一组环境文件。这些环境文件可以帮助对由 director 创建的 Overcloud 所支持的特定文件进行定制配置。其中,包括一个用来对存储进行配置的环境文件(/usr/share/openstack-tripleo-heat-templates/environments/storage-environment.yaml)。把这个文件复制到 stack 用户的模板目录中。
$ cp /usr/share/openstack-tripleo-heat-templates/environments/storage-environment.yaml ~/templates/.
环境文件包括了一些参数,它们可以帮助配置 Openstack 的块和镜像存储、cinder 和 glance 的不同存储选项。在这个示例中,您把 Overcloud 配置为使用一个 NFS 共享。修改以下参数:
- CinderEnableIscsiBackend
- 启用 iSCSI 后端。把它设置为
false。 - CinderEnableRbdBackend
- 启用 Ceph 存储后台。把它设置为
false。 - CinderEnableNfsBackend
- 启动 NFS 后端。把它设置为
true。 - NovaEnableRbdBackend
- 为 Nova 临时存储(ephemeral storage)启用 Ceph 存储。把它设置为
false。 - GlanceBackend
- 定义 Glance 的后端。把它设为
file来为镜像使用基于文件的存储。Overcloud 会为 Glance 在一个挂载的 NFS 共享中存储这些文件。 - CinderNfsMountOptions
- 卷存储的 NFS 挂载选项。
- CinderNfsServers
- 为卷共享挂载的 NFS 共享。例如,
192.168.122.1:/export/cinder。 - GlanceFilePcmkManage
- 为镜像存储启用 Pacemaker 来管理共享。如果被禁用,Overcloud 会把镜像存储在 Controller 节点的文件系统中。把它设置为
true。 - GlanceFilePcmkFstype
- 定义 Pacemaker 用来进行镜像存储的文件系统类型。把它设为
nfs。 - GlanceFilePcmkDevice
- 挂载的、用于镜像存储的 NFS 共享。例如:
192.168.122.1:/export/glance。 - GlanceFilePcmkOptions
- 用于镜像存储的 NFS 挂载选项。
环境文件的选项应该和以下类似:
parameter_defaults: CinderEnableIscsiBackend: false CinderEnableRbdBackend: false CinderEnableNfsBackend: true NovaEnableRbdBackend: false GlanceBackend: 'file' CinderNfsMountOptions: 'rw,sync' CinderNfsServers: '192.0.2.230:/cinder' GlanceFilePcmkManage: true GlanceFilePcmkFstype: 'nfs' GlanceFilePcmkDevice: '192.0.2.230:/glance' GlanceFilePcmkOptions: 'rw,sync,context=system_u:object_r:glance_var_lib_t:s0'
重要
在
GlanceFilePcmkOptions 参数中包括 context=system_u:object_r:glance_var_lib_t:s0 允许 glance 访问 /var/lib 目录。如果没有这个 SELinux 设置,glance 将无法写挂载点。
这些参数被集成在一起作为 heat 模板集合的一部分。这样设置它们会创建两个 cinder 和 glance 使用的 NFS 挂载点。
保存这个文件。

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.