客户端能够将请求发送到 endponits 指定的地址,向 cinder-api 请求操做。 固然,做为最终用户的咱们不会直接发送 Rest API 请求。OpenStack CLI,Dashboard 和其余须要跟 Cinder 交换的组件会使用这些 API。前端
cinder-api 接受哪些请求呢?简单的说,只要是 Volume 生命周期相关的操做,cinder-api 均可以响应。大部分操做均可以在 Dashboard 上看到。node
经过 Driver 架构支持多种 Volume Providerpython
接着的问题是:如今市面上有这么多块存储产品和方案(volume provider),cinder-volume 如何与它们配合呢?算法
经过的 Driver 架构。 cinder-volume 为这些 volume provider 定义了统一的接口,volume provider 只须要实现这些接口,就能够 Driver 的形式即插即用到 OpenStack 系统中。数据库
按期向 OpenStack 报告计算节点的状态vim
cinder-volume 会按期向 Cinder 报告存储节点的空闲容量来作筛选启动volume后端
实现 volume 生命周期管理
api
Cinder 对 volume 的生命周期的管理最终都是经过 cinder-volume 完成的,包括 volume 的 create、extend、attach、snapshot、delete 等。
服务器
1)建立cinder数据库并受权网络
MariaDB [(none)]> CREATE DATABASE cinder; MariaDB [(none)]> GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'localhost' \ IDENTIFIED BY 'CINDER_DBPASS'; MariaDB [(none)]> GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'%' \ IDENTIFIED BY 'CINDER_DBPASS';
2)建立用户cinder
openstack user create --domain default --password-prompt cinder
3)给cinder用户授予管理员权限
openstack role add --project service --user cinder admin
4)建立cinderv2和cinderv3服务
openstack service create --name cinderv2 \ --description "OpenStack Block Storage" volumev2
openstack service create --name cinderv3 \ --description "OpenStack Block Storage" volumev3
5)再分别建立cinderv2和cinderv3的服务端点
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
6)下载openstack-cinder安装
yum install openstack-cinder
7)编辑cinder配置文件
[lvm] volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver volume_group = cinder-volumes #volumes_dir = $state_path/volumes iscsi_protocol = iscsi iscsi_helper = lioadm #iscsi_ip_address = 192.168.253.135 #本机ip
8)同步数据库
su -s /bin/sh -c "cinder-manage db sync" cinder
9)编辑nova数据库,取消下面注释
[cinder]
os_region_name = RegionOne
10)重启相关服务
systemctl restart openstack-nova-api.service
# systemctl enable openstack-cinder-api.service openstack-cinder-scheduler.service # systemctl start openstack-cinder-api.service openstack-cinder-scheduler.service
11)查看是否部署成功
openstack volume service list
| Binary | Host | Zone | Status | State | Updated At | +------------------+-------------+------+---------+-------+----------------------------+ | cinder-scheduler | controller | nova | enabled | up | 2019-06-06T08:59:35.000000 | +------------------+-------------+------+---------+-------+----------------------------
1)安装lvm安装包
openstack-cinder targetcli python-keystone lvm2
2)建立物理卷/卷组和逻辑卷
pvcreate /dev/sdb
vgcreate cinder-volumes /dev/sdb
3)编辑配置文件/etc/lvm/lvm.conf(315行后面添加,注意不要超出大括号)
devices { ... filter = [ "a/sdb/", "r/.*/"]
4)配置cinder配置文件,下面是须要修改的地方
vim /etc/lvm/lvm.conf
[lvm]
volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver
volume_group = cinder-volumes
iscsi_protocol = iscsi
iscsi_helper = lioadm
5)重启lvm和cinder服务
# systemctl enable openstack-cinder-volume.service target.service
# systemctl start openstack-cinder-volume.service target.service
6)控制节点查看是否部署成功openstack volume service list