# yum list *cinder*

# yum install *cinder* -y

# openstack user create cinder --password redhat

# openstack role add --user cinder --project services admin

# openstack service create --name cinder volume

# openstack endpoint create --region RegionOne --publicurl 'http://192.

168.179.140:8776/v1/%(tenant_id)s' --internalurl 'http://192.168.179.140:8776/v1/%(tenant_id)s' --adminurl 'http://192.168.179.140:8776/v1/%(tenant_id)s'   d90608530d4348729cb3cb2a4df0f140

# openstack service create --name cinderv2 volumev2

# openstack endpoint create --region RegionOne --publicurl 'http://192.

168.179.140:8776/v2/%(tenant_id)s' --internalurl 'http://192.168.179.140:8776/v2/%(tenant_id)s' --adminurl 'http://192.168.179.140:8776/v2/%(tenant_id)s'   2edb4ecdb6ee483a8cccc57f445db6fb

 

20.cinder安装部署|lvm后端存储|存储有效域

 

20.cinder安装部署|lvm后端存储|存储有效域

 

20.cinder安装部署|lvm后端存储|存储有效域

 

20.cinder安装部署|lvm后端存储|存储有效域

 

20.cinder安装部署|lvm后端存储|存储有效域

 

20.cinder安装部署|lvm后端存储|存储有效域

 

 

修改配置文件:

从配置模板复制过来方便配置

20.cinder安装部署|lvm后端存储|存储有效域

 

20.cinder安装部署|lvm后端存储|存储有效域

 

配置数据库:

create database cinder;

grant all privileges on cinder.* to [email protected]'localhost' identified by 'redhat';

grant all privileges on cinder.* to [email protected]'%' identified by 'redhat';

grant all privileges on cinder.* to [email protected]'192.168.179.140' identified by 'redhat';

20.cinder安装部署|lvm后端存储|存储有效域

 

20.cinder安装部署|lvm后端存储|存储有效域

 

# sh -c 'cinder-manage db sync' cinder

 

 

20.cinder安装部署|lvm后端存储|存储有效域

 

systemctl list-unit-files | grep cinder

20.cinder安装部署|lvm后端存储|存储有效域

 

20.cinder安装部署|lvm后端存储|存储有效域

 

查看cinder:

# cinder list

# openstack volume list

20.cinder安装部署|lvm后端存储|存储有效域

 

创建volume:显示创建失败

 

20.cinder安装部署|lvm后端存储|存储有效域

查看log: /var/log/cinder/volume.log

20.cinder安装部署|lvm后端存储|存储有效域

 

即: 默认情况下,创建云硬盘的时候,默认使用lv作为后端存储,当每创建一个云硬盘,就会在cinder-volumes 里创建一个lv

现在的问题是没有这个卷组!!!因此新创建

20.cinder安装部署|lvm后端存储|存储有效域

 

20.cinder安装部署|lvm后端存储|存储有效域

 

修改配置文件,增加volume_driver配置并重启服务

20.cinder安装部署|lvm后端存储|存储有效域

volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver

20.cinder安装部署|lvm后端存储|存储有效域

 

20.cinder安装部署|lvm后端存储|存储有效域

重新创建volume

20.cinder安装部署|lvm后端存储|存储有效域

 

20.cinder安装部署|lvm后端存储|存储有效域

 

P.S: 默认使用的卷组是cinder-volumes 这个默认的卷组是可以修改的。

从备份的配置文件中过滤出默认选项,添加到配置文件中 并修改名字

20.cinder安装部署|lvm后端存储|存储有效域

 

将卷组的名字改成myvg

20.cinder安装部署|lvm后端存储|存储有效域

 

20.cinder安装部署|lvm后端存储|存储有效域

重新创建volume并测试:如下

 

20.cinder安装部署|lvm后端存储|存储有效域

########################################################################################################

测试环境:

使用OSP1(packstack安装好的cinder)以及osp3新建的cinder,分别定义不同的storage_availablity_zone.

让让OSP3的cinder endpoint指向 OSP1的keystone 来验证,从而进行测试cinder的存储有效域。

OSP3:cinder keystone认证修改:

20.cinder安装部署|lvm后端存储|存储有效域

 

20.cinder安装部署|lvm后端存储|存储有效域

 

20.cinder安装部署|lvm后端存储|存储有效域

 

修改OSP1的cinder配置文件如下:

20.cinder安装部署|lvm后端存储|存储有效域

 

20.cinder安装部署|lvm后端存储|存储有效域

 

20.cinder安装部署|lvm后端存储|存储有效域

 

OSP1需要添加endpoint 指向才行OSP3:

20.cinder安装部署|lvm后端存储|存储有效域

 

20.cinder安装部署|lvm后端存储|存储有效域

 

重启服务:

20.cinder安装部署|lvm后端存储|存储有效域

 

20.cinder安装部署|lvm后端存储|存储有效域

 

在OSP1的dashboard上创建volume测试:az137 如下:

20.cinder安装部署|lvm后端存储|存储有效域

 

20.cinder安装部署|lvm后端存储|存储有效域

在OSP1的dashboard上创建volume测试:az140 如下:

20.cinder安装部署|lvm后端存储|存储有效域

 

20.cinder安装部署|lvm后端存储|存储有效域

如下OSP1上的volume ID

20.cinder安装部署|lvm后端存储|存储有效域

OSP3上的volume ID 如下:

即OSP1上面图片中的第一个ID

20.cinder安装部署|lvm后端存储|存储有效域

 

 

 

 

相关文章: