第 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 集群的集群名称和位于
/etc/
上的 Ceph 配置文件。如果 Ceph 集群名称不是ceph
/ceph.confceph
,请相应地指定集群名称和配置文件路径: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]
部分及其设置。