部署cinder
1. 部署说明
部署地点: 控制节点(ip:192.168.0.142)。
2. 创建一个lvm的分区
storage node (没有存储节点,使用controller上的存储 )。
在选定磁盘上创建一个lvm的分区。
fdisk /dev/sba
fdisk -l
输出信息:
#Disk /dev/sda
#设备 起点 末尾 扇区 大小 类型
#/dev/sda1 2048 3400000000 3399997953 1.6T Linux 文件系统
#/dev/sda2 3400001536 7812939742 4412938207 2.1T Linux LVM
3. 安装软件包
yum install -y lvm2 device-mapper-persistent-data
4. 启动lvm2-lvmetad服务
systemctl enable lvm2-lvmetad.service
systemctl start lvm2-lvmetad.service
创建 LVM 物理卷 /dev/sda2:
pvcreate /dev/sda2
创建 LVM 卷组 cinder-volumes。
vgcreate cinder-volumes /dev/sda2
5. 编辑/etc/lvm/lvm.conf
在设备部分,添加一个过滤器,接受 /dev/sda2 设备,拒绝所有其他设备。
devices {
...
filter = [ "a/sda2/", "r/.*/"]
6. 安装cinder
yum install -y openstack-cinder targetcli
7. 创建cinder数据库
mysql -uroot -ploongson -e 'CREATE DATABASE cinder;'
mysql -uroot -ploongson -e "GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'localhost' IDENTIFIED BY 'loongson';"
mysql -uroot -ploongson -e "GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'%' IDENTIFIED BY 'loongson';"
创建服务证书并输入密码 loongson。
openstack user create --domain default --password-prompt cinder
为cinder用户添加管理员角色:
openstack role add --project service --user cinder admin
创建 cinderv2 和 cinderv3 服务实体:
openstack service create --name cinderv2 --description "OpenStack Block Storage" volumev2
openstack service create --name cinderv3 --description "OpenStack Block Storage" volumev3
创建块存储服务 API 端点:
openstack endpoint create --region RegionOne volumev2 public http://controller:8776/v2/%\(project_id\)s
openstack endpoint create --region RegionOne volumev2 internal http://controller:8776/v2/%\(project_id\)s
openstack endpoint create --region RegionOne volumev2 admin http://controller:8776/v2/%\(project_id\)s
openstack endpoint create --region RegionOne volumev3 public http://controller:8776/v3/%\(project_id\)s
openstack endpoint create --region RegionOne volumev3 internal http://controller:8776/v3/%\(project_id\)s
openstack endpoint create --region RegionOne volumev3 admin http://controller:8776/v3/%\(project_id\)s
cp /etc/cinder/cinder.conf /etc/cinder/cinder.conf.bak
crudini --set /etc/cinder/cinder.conf database connection mysql+pymysql://cinder:loongson@controller/cinder
crudini --set /etc/cinder/cinder.conf DEFAULT transport_url rabbit://guest:loongson@controller
crudini --set /etc/cinder/cinder.conf DEFAULT auth_strategy keystone
crudini --set /etc/cinder/cinder.conf DEFAULT my_ip 192.168.0.142
crudini --set /etc/cinder/cinder.conf DEFAULT enabled_backends lvm
crudini --set /etc/cinder/cinder.conf DEFAULT glance_api_servers http://controller:9292
crudini --set /etc/cinder/cinder.conf keystone_authtoken www_authenticate_uri http://controller:5000
crudini --set /etc/cinder/cinder.conf keystone_authtoken auth_url http://controller:5000
crudini --set /etc/cinder/cinder.conf keystone_authtoken memcached_servers = controller:11211
crudini --set /etc/cinder/cinder.conf keystone_authtoken auth_type password
crudini --set /etc/cinder/cinder.conf keystone_authtoken project_domain_name default
crudini --set /etc/cinder/cinder.conf keystone_authtoken user_domain_name default
crudini --set /etc/cinder/cinder.conf keystone_authtoken project_name service
crudini --set /etc/cinder/cinder.conf keystone_authtoken username cinder
crudini --set /etc/cinder/cinder.conf keystone_authtoken password loongson
crudini --set /etc/cinder/cinder.conf oslo_concurrency lock_path /var/lib/cinder/tmp
crudini --set /etc/cinder/cinder.conf lvm volume_driver cinder.volume.drivers.lvm.LVMVolumeDriver
crudini --set /etc/cinder/cinder.conf lvm volume_group cinder-volumes
crudini --set /etc/cinder/cinder.conf lvm target_protocol iscsi
crudini --set /etc/cinder/cinder.conf lvm target_helper lioadm
crudini --set /etc/cinder/cinder.conf lvm volume_backend_name LVM
填充块存储数据库。
su -s /bin/sh -c "cinder-manage db sync" cinder
egrep -v "^#|^$" /etc/cinder/cinder.conf
crudini --set /etc/nova/nova.conf cinder os_region_name RegionOne
systemctl restart openstack-nova-api.service
systemctl enable openstack-cinder-volume.service target.service openstack-cinder-api.service openstack-cinder-scheduler.service
systemctl restart openstack-cinder-volume.service target.service openstack-cinder-api.service openstack-cinder-scheduler.service
systemctl status openstack-cinder-volume.service target.service openstack-cinder-api.service openstack-cinder-scheduler.service
创建一个volume type并关联到volume_backend_name。
cinder type-create LVM
cinder type-key LVM set volume_backend_name=LVM
cinder extra-specs-list
输出信息:
+--------------------------------------+-------------+--------------------------------+
| ID | Name | extra_specs |
+--------------------------------------+-------------+--------------------------------+
| 17fcfe8d-e863-4133-aa84-3f05ed031bb2 | __DEFAULT__ | {} |
| ff4e854b-e17a-42e1-b202-4b15148dbc14 | LVM | {'volume_backend_name': 'LVM'} |
+--------------------------------------+-------------+--------------------------------+