cinder支持后端多种backends共存,确实很适合用户的需求。最近我们公司自己的内部openstack平台后端有sata、ssd的glusterfs volume,研究了下cinder multi backends的配置。实际上主要就是cinder.conf了。


搭建glusterfs集群看这里:http://iceyao.blog.51cto.com/9426658/1634839


cinder.conf 配置文件如下:

[DEFAULT]
enabled_backends = glusterfs1,glusterfs2  # 启用两种glusterfs volume
default_volume_type = sata  # 默认cinder type,待会会创建
[glusterfs1] 
glusterfs_shares_config=/etc/cinder/glusterfs_shares1
volume_driver=cinder.volume.drivers.glusterfs.GlusterfsDriver
volume_backend_name=openstack  # 待会设置cinder type key的时候用到
[glusterfs2]
glusterfs_shares_config=/etc/cinder/glusterfs_shares2
volume_driver=cinder.volume.drivers.glusterfs.GlusterfsDriver
volume_backend_name=ssd

[root@controller001 cinder(keystone_admin)]# cat glusterfs_shares1
gluster002.sh.99cloud.net:/openstack   # sata volume路径
[root@controller001 cinder(keystone_admin)]# cat glusterfs_shares2
gluster002.sh.99cloud.net:/ssd    # ssd volume路径

cinder type-create sata  #  cinder sata类型,这也是default_volume_type,名字要对应
cinder type-key sata set volume_backend_name=openstack  #为sata类型设置key value,跟上面的cinder.conf里面的配置文件对应的
cinder type-create ssd  # cinder ssd类型
cinder type-key ssd set volume_backend_name=ssd # 为ssd类型设置key value

# compute节点端测试glusterfs libgfapi
cat /etc/nova/nova.conf   # 虚拟机挂载云硬盘(libgfapi访问glusterfs volume)
[libvirt]
qemu_allowed_storage_drivers = gluster # nova libgfapi配置项

qemu-img create gluster://$GLUSTER_HOST/$GLUSTER_VOLUME/p_w_picpaths 5G


参考资料:redhat openstack认证培训教材

                http://blog.flaper87.org/post/nova-glusterfs-direct-access/