第 3 章 配置 OpenStack 以使用 Ceph 块设备
作为存储管理员,您必须配置 Red Hat OpenStack Platform 以使用 Ceph 块设备。Red Hat OpenStack Platform 可以使用 Ceph 块设备用于 Cinder、Cinder 备份、Glance 和 Nova。
先决条件
- 新的或现有的 Red Hat Ceph Storage 集群。
- 正在运行的 Red Hat OpenStack Platform 环境。
3.1. 配置 Cinder 以使用 Ceph 块设备
Red Hat OpenStack Platform 可以使用 Ceph 块设备为 Cinder 卷提供后端存储。
先决条件
- Cinder 节点的根级别访问权限。
-
Ceph
卷池。 - 与 Ceph 块设备交互的机密的用户和 UUID。
流程
编辑 Cinder 配置文件:
[root@cinder ~]# vim /etc/cinder/cinder.conf
在
[DEFAULT]部分中,启用 Ceph 作为 Cinder 的后端:enabled_backends = ceph
确保 Glance API 版本设为 2。如果要在
enabled_backends中配置多个 Cinder 后端,glance_api_version = 2设置必须位于[DEFAULT]部分中,而不是[ceph]部分。glance_api_version = 2
-
在
cinder.conf文件中创建一个[ceph]部分。在[ceph]部分下的下列步骤中添加 Ceph 设置。 指定
volume_driver设置,并将其设置为使用 Ceph 块设备驱动程序:volume_driver = cinder.volume.drivers.rbd.RBDDriver
指定集群名称和 Ceph 配置文件的位置。在典型的部署中,Ceph 集群具有集群名称
ceph和位于/etc/ceph/ceph.conf的 Ceph 配置文件。如果 Ceph 集群名称不是ceph,请相应地指定集群名称和配置文件路径:rbd_cluster_name = us-west rbd_ceph_conf = /etc/ceph/us-west.conf
默认情况下,Red Hat OpenStack Platform 将 Ceph 卷存储在
rbd池中。要使用之前创建的volumes池,请指定rbd_pool设置并设置volumes池:rbd_pool = volumes
Red Hat OpenStack Platform 没有卷的默认用户名或 secret 的 UUID。指定
rbd_user,并将它设为cinder用户。然后,指定rbd_secret_uuid设置,并将其设置为存储在uuid-secret.txt文件中生成的 UUID:rbd_user = cinder rbd_secret_uuid = 4b5fd580-360c-4f8c-abb5-c83bb9a3f964
指定以下设置:
rbd_flatten_volume_from_snapshot = false rbd_max_clone_depth = 5 rbd_store_chunk_size = 4 rados_connect_timeout = -1
当您将 Cinder 配置为使用 Ceph 块设备时,配置文件可能类似如下:
示例
[DEFAULT] enabled_backends = ceph glance_api_version = 2 … [ceph] volume_driver = cinder.volume.drivers.rbd.RBDDriver rbd_cluster_name = ceph rbd_pool = volumes rbd_user = cinder rbd_ceph_conf = /etc/ceph/ceph.conf rbd_flatten_volume_from_snapshot = false rbd_secret_uuid = 4b5fd580-360c-4f8c-abb5-c83bb9a3f964 rbd_max_clone_depth = 5 rbd_store_chunk_size = 4 rados_connect_timeout = -1
注意考虑删除默认的
[lvm]部分及其设置。