客戶端能夠將請求發送到 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