Openstack cinder configuration with multi ceph pools

添加rbd相关配置

文件:/opt/etc/cinder/cinder.conf

删除之前cinder中rbd的配置,然后添加如下配置:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# Define the names of the groups for multiple volume backends
enabled_backends = rbd-sata,rbd-ssd

# Define the groups as above
[rbd-sata]
volume_driver = cinder.volume.drivers.rbd.RBDDriver
rbd_user = cinder
rbd_pool = volumes
volume_backend_name = RBD_SATA
rbd_ceph_conf = /etc/ceph/ceph.conf

[rbd-ssd]
volume_driver = cinder.volume.drivers.rbd.RBDDriver
rbd_user = cinder
rbd_pool = volumes_hp
volume_backend_name = RBD_SSD
rbd_ceph_conf = /etc/ceph/ceph.conf

rbd的其他如下配置

可以根据需要添加到不同的backend设置中。

1
2
3
4
5
6
7
8
rbd_flatten_volume_from_snapshot = false
rbd_max_clone_depth = 5
rbd_store_chunk_size = 4
rados_connect_timeout = -1

# if cephX is enable
rbd_user=cinder
rbd_secret_uuid=<None>

同一backend用多个pools

若要支持同一个backend用多个pools,可以类似如下配置:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
enabled_backends = rbd-sata,rbd-ssd-1,rbd-ssd-2
[rbd-ssd-1]
volume_driver = cinder.volume.drivers.rbd.RBDDriver
rbd_user = cinder
rbd_pool = volumes_hp-1
volume_backend_name = RBD_SSD
rbd_ceph_conf = /etc/ceph/ceph.conf

[rbd-ssd-2]
volume_driver = cinder.volume.drivers.rbd.RBDDriver
rbd_user = cinder
rbd_pool = volumes_hp-2
volume_backend_name = RBD_SSD
rbd_ceph_conf = /etc/ceph/ceph.conf

添加LVM支持

cinder添加LVM支持,类似如下配置:

因为LVM是固定在每个host上的,每个host的cinder.conf文件也只需要配置添加本地的LVM信息即可。

1
2
3
4
5
6
7
8
9
10
11
12
# Define the names of the groups for multiple volume backends
enabled_backends = rbd-sata,rbd-ssd,lvm-1,lvm-2
...
[lvm-1]
volume_group = volume-group1
volume_driver=cinder.volume.drivers.lvm.LVMISCSIDriver
volume_backend_name=LVM_iSCSI

[lvm-2]
volume_group = volume-group2
volume_driver=cinder.volume.drivers.lvm.LVMISCSIDriver
volume_backend_name=LVM_iSCSI

添加cinder对应lvm的类型和backend:

1
2
3
cinder type-create lvm
cinder type-key lvm set volume_backend_name=LVM_iSCSI
cinder extra-specs-list

然后重启cinder所有服务

1
2
3
4
service cinder-api restart
service cinder-scheduler restart
service cinder-volume restart
service cinder-backup restart

若还不行,尝试执行下面的命令:
安装 cinder 相关包

1
# apt-get install -y lvm2 tgt

问题

有一个错误跟cinder-rootwrap有关系,代码中会调用 sudo cinder-rootwrap命令:
若不是用root用户部署的,就需要创建如下的一个软连接:

1
ln -s /opt/openstack/.venv/bin/cinder-rootwrap /usr/bin/cinder-rootwrap
支持原创