mysql -u root -proot
CREATE DATABASE cinder;
GRANT ALL PRIVILEGES ON cinder.* TO ‘cinder‘@‘localhost‘ IDENTIFIED BY ‘CINDER_DBPASS‘;
GRANT ALL PRIVILEGES ON cinder.* TO ‘cinder‘@‘%‘ IDENTIFIED BY ‘CINDER_DBPASS‘;
#运行环境变量
. admin-openrc
#创建cinder用户并添加角色为admin
openstack user create --domain default --password CINDER_PASS cinder
openstack role add --project service --user cinder admin
#创建cinder和cinderv2服务
openstack service create --name cinder --description "OpenStack Block Storage" volume
openstack service create --name cinderv2 --description "OpenStack Block Storage" volumev2
#创建cinder和cinderv2服务站点
openstack endpoint create --region RegionOne volume public http://ctrl.test.com:8776/v1/%\(project_id\)s
openstack endpoint create --region RegionOne volume internal http://ctrl.test.com:8776/v1/%\(project_id\)s
openstack endpoint create --region RegionOne volume admin http://ctrl.test.com:8776/v1/%\(project_id\)s
openstack endpoint create --region RegionOne volumev2 public http://ctrl.test.com:8776/v2/%\(project_id\)s
openstack endpoint create --region RegionOne volumev2 internal http://ctrl.test.com:8776/v2/%\(project_id\)s
openstack endpoint create --region RegionOne volumev2 admin http://ctrl.test.com:8776/v2/%\(project_id\)s
#安装cinder软件并编辑cinder配置文件
yum install openstack-cinder -y
vim /etc/cinder/cinder.conf
[database]
connection = mysql+pymysql://cinder:CINDER_DBPASS@base.test.com/cinder
[DEFAULT]
transport_url = rabbit://openstack:RABBIT_PASS@base.test.com
auth_strategy = keystone
my_ip = 172.16.2.52
[keystone_authtoken]
auth_uri = http://ctrl.test.com:5000
auth_url = http://ctrl.test.com:35357
memcached_servers = base.test.com:11211
auth_type = password
project_domain_id = default
user_domain_id = default
project_name = service
username = cinder
password = CINDER_PASS
[oslo_concurrency]
lock_path = /var/lib/cinder/tmp
#填充数据库
su -s /bin/sh -c "cinder-manage db sync" cinder
#编辑Nova配置文件
vim /etc/nova/nova.conf
[cinder]
os_region_name = RegionOne
#启动服务
systemctl restart openstack-nova-api.service
systemctl restart openstack-cinder-api.service openstack-cinder-scheduler.service
systemctl enable openstack-cinder-api.service openstack-cinder-scheduler.service
systemctl status openstack-cinder-api.service openstack-cinder-scheduler.service
#验证
. admin-openrc
openstack volume service list
#安装软件
yum install lvm2 -y
#启动lvm2服务
systemctl restart lvm2-lvmetad.service
systemctl enable lvm2-lvmetad.service
systemctl status lvm2-lvmetad.service
#创建VG
pvcreate /dev/vdb
vgcreate cinder-volumes /dev/vdb
#编辑lvm配置文件
vim /etc/lvm/lvm.conf
devices {
filter = [ "a/vda/", "a/vdb/", "r/.*/"]
#安装cinder软件并编辑配置文件
yum install openstack-cinder targetcli python-keystone -y
vim /etc/cinder/cinder.conf
[database]
connection = mysql+pymysql://cinder:CINDER_DBPASS@base.test.com/cinder
[DEFAULT]
transport_url = rabbit://openstack:RABBIT_PASS@base.test.com
auth_strategy = keystone
my_ip = 172.16.2.54
enabled_backends = lvm
glance_api_servers = http://ctrl.test.com:9292
[keystone_authtoken]
auth_uri = http://ctrl.test.com:5000
auth_url = http://ctrl.test.com:35357
memcached_servers = base.test.com:11211
auth_type = password
project_domain_id = default
user_domain_id = default
project_name = service
username = cinder
password = CINDER_PASS
[lvm]
volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver
volume_group = cinder-volumes
iscsi_protocol = iscsi
iscsi_helper = lioadm
[oslo_concurrency]
lock_path = /var/lib/cinder/tmp
#启动cinder服务
systemctl restart openstack-cinder-volume.service target.service
systemctl enable openstack-cinder-volume.service target.service
systemctl status openstack-cinder-volume.service target.service
原文:https://www.cnblogs.com/chenli90/p/10351537.html