安装cindoer块存储服务节点(存储节点192.168.0.40)
使用默认的LVM卷方法,之后改为ceph存储
安装LVM软件包
[root@cinder01 ~]# yum install lvm2 device-mapper-persistent-data -y
启动LVM元数据服务,并设置开机自启
systemctl enable lvm2-lvmetad.service systemctl restart lvm2-lvmetad.service
添加一块100G硬盘,重启节点后创建LVM物理卷/dev/sdb
[root@cinder01 ~]# pvcreate /dev/sdb Physical volume "/dev/sdb" successfully created.
创建LVM物理卷
[root@cinder01 ~]# vgcreate cinder-volumes /dev/sdb Volume group "cinder-volumes" successfully created
编辑配置文件/etc/lvm/lvm.conf
在devices部分,添加一个过滤器,只接受/dev/sdb设备,拒绝其他所有设备
[root@cinder01 ~]# vim /etc/lvm/lvm.conf devices { filter = [ "a/sdb/", "r/.*/" ]
安装train版yum源和cinder软件包
yum install centos-release-openstack-train -y yum install openstack-cinder targetcli python-keystone openstack-utils -y
编辑配置文件/etc/cinder/cinder.conf
cp /etc/cinder/cinder.conf /etc/cinder/cinder.conf.bak grep -Ev '#|^$' /etc/cinder/cinder.conf.bak>/etc/cinder/cinder.conf openstack-config --set /etc/cinder/cinder.conf database connection mysql+pymysql://cinder:CINDER_DBPASS@controller/cinder openstack-config --set /etc/cinder/cinder.conf DEFAULT transport_url rabbit://openstack:RABBIT_PASS@controller openstack-config --set /etc/cinder/cinder.conf DEFAULT auth_strategy keystone openstack-config --set /etc/cinder/cinder.conf DEFAULT my_ip 192.168.0.40 openstack-config --set /etc/cinder/cinder.conf DEFAULT enabled_backends lvm openstack-config --set /etc/cinder/cinder.conf DEFAULT glance_api_servers http://controller:9292 openstack-config --set /etc/cinder/cinder.conf keystone_authtoken www_authenticate_uri http://controller:5000 openstack-config --set /etc/cinder/cinder.conf keystone_authtoken auth_url http://controller:5000 openstack-config --set /etc/cinder/cinder.conf keystone_authtoken memcached_servers controller:11211 openstack-config --set /etc/cinder/cinder.conf keystone_authtoken auth_type password openstack-config --set /etc/cinder/cinder.conf keystone_authtoken project_domain_name default openstack-config --set /etc/cinder/cinder.conf keystone_authtoken user_domain_name default openstack-config --set /etc/cinder/cinder.conf keystone_authtoken project_name service openstack-config --set /etc/cinder/cinder.conf keystone_authtoken username cinder openstack-config --set /etc/cinder/cinder.conf keystone_authtoken password CINDER_PASS openstack-config --set /etc/cinder/cinder.conf lvm volume_driver cinder.volume.drivers.lvm.LVMVolumeDriver openstack-config --set /etc/cinder/cinder.conf lvm volume_group cinder-volumes openstack-config --set /etc/cinder/cinder.conf lvm target_protocol iscsi openstack-config --set /etc/cinder/cinder.conf lvm target_helper lioadm openstack-config --set /etc/cinder/cinder.conf oslo_concurrency lock_path /var/lib/cinder/tmp
启动块存储卷服务并设置开机自启动
systemctl restart openstack-cinder-volume.service target.service systemctl enable openstack-cinder-volume.service target.service
在控制节点进行验证
[root@controller ~]# source ~/admin-openrc [root@controller ~]# openstack volume service list +------------------+--------------+------+---------+-------+----------------------------+ | Binary | Host | Zone | Status | State | Updated At | +------------------+--------------+------+---------+-------+----------------------------+ | cinder-scheduler | controller | nova | enabled | up | 2020-04-27T02:54:41.000000 | | cinder-volume | cinder01@lvm | nova | enabled | up | 2020-04-27T02:54:01.000000 | +------------------+--------------+------+---------+-------+----------------------------+
可以到Dashboard界面上进行操作