cinder-api
 
cinder-api 是整个Cinder 组件的门户,所有cinder 的请求都首先由 cinder-api 处理。cinder-api 向外界暴露若干 HTTP REST API 接口。在 keystone 中我们可以查询 cinder-api 的Endpoints。
 
[stack@DevStack-Rocky-Controller-31 ~]$ openstack endpoint list
+----------------------------------+-----------+--------------+----------------+---------+-----------+----------------------------------------------+
| ID                               | Region    | Service Name | Service Type   | Enabled | Interface | URL                                          |
+----------------------------------+-----------+--------------+----------------+---------+-----------+----------------------------------------------+
| 047e022b05b7470c85ea5bb7229a56d8 | RegionOne | cinderv2     | volumev2       | True    | public    | http://10.12.30.31/volume/v2/$(project_id)s  |
| 0fb43b56acd44139a601352ad8576c6a | RegionOne | glance       | image          | True    | public    | http://10.12.30.31/image                     |
| 19bb7e53164b4ec6a1e4d4c264bb586d | RegionOne | barbican     | key-manager    | True    | internal  | http://10.12.30.31/key-manager               |
| 1c3ac7b978234b8ca994f261ac0dd4e4 | RegionOne | mistral      | workflowv2     | True    | admin     | http://10.12.30.31:8989/v2                   |
| 1e53caf2fe854ef3add9d226b051e034 | RegionOne | cinder       | volume         | True    | public    | http://10.12.30.31/volume/v1/$(project_id)s  |
| 21203ae872ea4e078161b7e44513a322 | RegionOne | nova_legacy  | compute_legacy | True    | public    | http://10.12.30.31/compute/v2/$(project_id)s |
| 22fd0fada43b440cb6b3c609fb4f6ec3 | RegionOne | barbican     | key-manager    | True    | public    | http://10.12.30.31/key-manager               |
| b83698fcabb24bd0b04ea988883f10c1 | RegionOne | cinder       | block-storage  | True    | public    | http://10.12.30.31/volume/v3/$(project_id)s  |
| c894d8a5bb0445be9f69adb8eda117d2 | RegionOne | mistral      | workflowv2     | True    | internal  | http://10.12.30.31:8989/v2                   |
| cce8033429c7447a992f9df313aafeaa | RegionOne | neutron      | network        | True    | public    | http://10.12.30.31:9696/                     |
| d685b7c6fd1b4a4d8488efecd8bb9bbc | RegionOne | keystone     | identity       | True    | public    | http://10.12.30.31/identity                  |
| d9ddc1876bb24dd8add95c113854ccef | RegionOne | nova         | compute        | True    | public    | http://10.12.30.31/compute/v2.1              |
| dfc13044d3cd46d7a2b60d0bab442013 | RegionOne | cinderv3     | volumev3       | True    | public    | http://10.12.30.31/volume/v3/$(project_id)s  |
| e4b6d476f0bc4da5bc9d977c8517afbe | RegionOne | mistral      | workflowv2     | True    | public    | http://10.12.30.31:8989/v2                   |
| eea21224c1af4e1d9ebdba70541ad49d | RegionOne | keystone     | identity       | True    | admin     | http://10.12.30.31/identity                  |
| f1963fa6fda64efb8dbc823571a25724 | RegionOne | placement    | placement      | True    | public    | http://10.12.30.31/placement                 |
+----------------------------------+-----------+--------------+----------------+---------+-----------+----------------------------------------------+
 
客户端可以将请求发送到 Endpoint 指定的地址,向 cinder-api 请求操作。当然,作为最终用户的为我们不会直接发送 REST API 请求。OpenStack CLI,Dashboard 和其他需要跟Cinder 交换的组件会使用这些API。
 
cinder-api 对接收到的 HTTP API 请求会做如下处理:
 
    1、检查客户端传入的参数是否合法有效
    2、调用cinder 的其他子服务处理客户端请求
    3、将cinder 其他子服务返回的结果序列号返回给客户端
 
cinder-api 接受那些请求呢?简单的说,只要是volume生命周期相关的操作,cinder-api都可以响应。大部分操作都可以在Dashboard上看到。
 
打开volume管理界面,点击下拉菜单,列表中就是cinder-api可执行的操作。
 
 
cinder-scheduler
 
创建volume 时,cinder-scheduler 会基于容量、volume type 等条件选择出最合适的存储节点,然后让其创建volume。
 
cinder-volume
 
cinder-volume 在存储节点上运行,OpenStack 对volume 的操作,最后都是交给cinder-volume来完成的。cinder-volume自身并不管理真正的存储设备,存储设备是由volume provider 管理的。cinder-volume 与 volume provider 一起实现volume生命周期的管理。
 
通过Driver架构支持多种 volume provider
 
接着的问题是:现在市面上有这么多块存储产品和方案(volume provider),cinder-volume如何与他们配合呢?
 
这就是我们之前讨论过的Driver架构。cinder-volume为这些volume provider定义了统一的接口,volume provider只需要实现这些接口,就可以Driver的形式即插即用到OpenStack系统中。下面是Cinder Driver 的架构示意图:
 
 
我们可以在 /opt/stack/cinder/cinder/volume/drivers/ 目录下查看到OpenStack源代码中已经自带了很多 volume provider 的 Driver
 
[stack@DevStack-Rocky-Controller-31 ~]$ ls /opt/stack/cinder/cinder/volume/drivers/
coprhd            ibm           nfs.py        synology
datacore          infinidat.py  nimble.py     tintri.py
datera            __init__.py   prophetstor   veritas
dell_emc          __init__.pyc  pure.py       veritas_access
disco             inspur        qnap.py       veritas_cnfs.py
dothill           kaminario     quobyte.py    vmware
drbdmanagedrv.py  lenovo        rbd.py        vzstorage.py
fujitsu           lvm.py        remotefs.py   windows
fusionstorage     lvm.pyc       san           zadara.py
hgst.py           nec           sheepdog.py   zfssa
hpe               netapp        solidfire.py
huawei            nexenta       storpool.py
 
存储节点在配置文件配置文件  /etc/cinder/cinder.conf 中,volume_driver 配置项设置该存储节点使用哪种 volume provider的driver。下面的示例表示使用的是LVM。
 
[stack@DevStack-Rocky-Controller-31 ~]$ cat /etc/cinder/cinder.conf | grep '_dri'
volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver
 
定期向OpenStack报告计算节点的状态
 
在前面cinder-scheduler会用到 CapacityFilter 和 CapacityWeigher,他们都是通过存储节点的空闲容量来做筛选。那么这里有个问题:Cinder是如何得知每个存储节点的空闲容量信息呢?
 
答案是:cinder-volume 会定期向Cinder报告
 
从cinder-volume 的日志中可以发现每隔一段时间,cinder-volume就会报告当前存储节点的资源使用情况。
 
提炼后的日志如下:
 
oslo_service.periodic_task    Running periodic task VolumeManager.publish_service_capabilities
cinder.volume.drivers.lvm     Updating volume stats
oslo_concurrency.processutils    Running cmd (subprocess): sudo cinder-rootwrap /etc/cinder/rootwrap.conf env LC_ALL=C vgs --noheadings --unit=g -o name,size,free,lv_count,uuid --separator : --nosuffix stack-volumes-lvmdriver-1
oslo_concurrency.processutils    CMD "sudo cinder-rootwrap /etc/cinder/rootwrap.conf env LC_ALL=C vgs --noheadings --unit=g -o name,size,free,lv_count,uuid --separator : --nosuffix stack-volumes-lvmdriver-1" returned: 0 in 0.240s
oslo_concurrency.processutils    Running cmd (subprocess): sudo cinder-rootwrap /etc/cinder/rootwrap.conf env LC_ALL=C lvs --noheadings --unit=g -o vg_name,name,size --nosuffix stack-volumes-lvmdriver-1
oslo_concurrency.processutils    CMD "sudo cinder-rootwrap /etc/cinder/rootwrap.conf env LC_ALL=C lvs --noheadings --unit=g -o vg_name,name,size --nosuffix stack-volumes-lvmdriver-1" returned: 0 in 0.235s
oslo_concurrency.processutils    Running cmd (subprocess): sudo cinder-rootwrap /etc/cinder/rootwrap.conf env LC_ALL=C lvs --noheadings --unit=g -o size,data_percent --separator : --nosuffix /dev/stack-volumes-lvmdriver-1/stack-volumes-lvmdriver-1-pool
oslo_concurrency.processutils    CMD "sudo cinder-rootwrap /etc/cinder/rootwrap.conf env LC_ALL=C lvs --noheadings --unit=g -o size,data_percent --separator : --nosuffix /dev/stack-volumes-lvmdriver-1/stack-volumes-lvmdriver-1-pool" returned: 0 in 0.237s
oslo_concurrency.processutils    Running cmd (subprocess): sudo cinder-rootwrap /etc/cinder/rootwrap.conf env LC_ALL=C lvs --noheadings --unit=g -o vg_name,name,size --nosuffix stack-volumes-lvmdriver-1
oslo_concurrency.processutils    CMD "sudo cinder-rootwrap /etc/cinder/rootwrap.conf env LC_ALL=C lvs --noheadings --unit=g -o vg_name,name,size --nosuffix stack-volumes-lvmdriver-1" returned: 0 in 0.250s
cinder.manager    Notifying Schedulers of capabilities ...
 
日志中用来获取数据的命令执行结果如下:
 
[root@DevStack-Rocky-Compute-32 ~]# vgs --noheadings --unit=g -o name,size,free,lv_count,uuid --separator : --nosuffix stack-volumes-lvmdriver-1
  stack-volumes-lvmdriver-1:24.00:1.15:3:Qy82rv-xCV5-fb1N-Bvks-c8Df-wxr8-dxwepB
[root@DevStack-Rocky-Compute-32 ~]# lvs --noheadings --unit=g -o vg_name,name,size --nosuffix stack-volumes-lvmdriver-1
  stack-volumes-lvmdriver-1 stack-volumes-lvmdriver-1-pool              22.80
  stack-volumes-lvmdriver-1 volume-3ef7baa3-ef61-49b0-b31c-bc9f0c1312b3  1.00
  stack-volumes-lvmdriver-1 volume-9ebeca17-3b09-4370-a9aa-8d708924b865  1.00
[root@DevStack-Rocky-Compute-32 ~]# lvs --noheadings --unit=g -o size,data_percent --separator : --nosuffix /dev/stack-volumes-lvmdriver-1/stack-volumes-lv
  22.80:0.34
[root@DevStack-Rocky-Compute-32 ~]# lvs --noheadings --unit=g -o vg_name,name,size --nosuffix stack-volumes-lvmdriver-1
  stack-volumes-lvmdriver-1 stack-volumes-lvmdriver-1-pool              22.80
  stack-volumes-lvmdriver-1 volume-3ef7baa3-ef61-49b0-b31c-bc9f0c1312b3  1.00
  stack-volumes-lvmdriver-1 volume-9ebeca17-3b09-4370-a9aa-8d708924b865  1.00
 
实现volume 生命周期管理
 
Cinder 对 volume 的生命周期的管理最终都是通过cinder-volume完成的,包括volume 的 create 、extend、attach、snapshot、delete 等。后面章节会详细学习。

O047、 Cinder 组件详解的更多相关文章

  1. Cinder 组件详解 - 每天5分钟玩转 OpenStack(47)

    本节我们将详细讲解 Cinder 的各个子服务. cinder-api cinder-api 是整个 Cinder 组件的门户,所有 cinder 的请求都首先由 nova-api 处理.cinder ...

  2. OpenStack各组件详解和通信流程

    一.openstack由来 openstack最早由美国国家航空航天局NASA研发的Nova和Rackspace研发的swift组成.后来以apache许可证授权,旨在为公共及私有云平台建设.open ...

  3. OpenStack的Trove组件详解

    一:简介     一.背景 1. 对于公有云计算平台来说,只有计算.网络与存储这三大服务往往是不太够的,在目前互联网应用百花齐放的背景下,几乎所有应用都使用到数据库,而数据库承载的往往是应用最核心的数 ...

  4. Android中Intent组件详解

    Intent是不同组件之间相互通讯的纽带,封装了不同组件之间通讯的条件.Intent本身是定义为一个类别(Class),一个Intent对象表达一个目的(Goal)或期望(Expectation),叙 ...

  5. Android笔记——四大组件详解与总结

     android四大组件分别为activity.service.content provider.broadcast receiver. ------------------------------- ...

  6. vue.js基础知识篇(6):组件详解

    第11章:组件详解 组件是Vue.js最推崇也最强大的功能之一,核心目标是可重用性. 我们把组件代码按照template.style.script的拆分方式,放置到对应的.vue文件中. 1.注册 V ...

  7. Echars 6大公共组件详解

    Echars 六大组件详解 : title  tooltip toolbox legend  dataZoom visualMap 一.title标题详解 myTitleStyle = { color ...

  8. Angular6 学习笔记——组件详解之组件通讯

    angular6.x系列的学习笔记记录,仍在不断完善中,学习地址: https://www.angular.cn/guide/template-syntax http://www.ngfans.net ...

  9. Angular6 学习笔记——组件详解之模板语法

    angular6.x系列的学习笔记记录,仍在不断完善中,学习地址: https://www.angular.cn/guide/template-syntax http://www.ngfans.net ...

随机推荐

  1. Mac下安装brew

    1.Mac 终端下,执行以下命令,即可安装brew: /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Hom ...

  2. ios 报错记录

    1. 运行xcode 报错:unterminated conditional directive #ifdef 缺少对应的#endif 在结尾加上就好了 2.iOS添加非(c,c++)文件引发的&qu ...

  3. linux服务之redis

    redis wget http://download.redis.io/releases/redis-4.0.6.tar.gzcd redis-4.0.6makecd src/./redis-serv ...

  4. 【Taro全实践】6位验证码输入视觉分离(标准下划线分离)

    一.实现的效果图 二.实现思路 中间想过很多实现方法,但是因为input为原生组件的原因,很难适配所有手机直接. 所有如何实现适配所有手机的验证码分离输入呢?(思路如下) 1.input组件为原生组件 ...

  5. OpenCL如何获取最小线程并行粒度

    由于OpenCL是为各类处理器设备而打造的开发标准的计算语言.因此跟CUDA不太一样的是,其对设备特征查询的项更上层,而没有提供一些更为底层的特征查询.比如,你用OpenCL的设备查询API只能获取最 ...

  6. Module ngx_http_rewrite_module

    http://nginx.org/en/docs/http/ngx_http_rewrite_module.html Directives     break     if     return    ...

  7. 深度学习之NLP获取词向量

    1.代码 def clean_text(text, remove_stopwords=False): """ 数据清洗 """ text = ...

  8. C# 批处理制作静默安装程序包

    使用批处理+WinRAR制作静默安装程序包 @echo 安装完窗口会自动关闭!!! @echo off start /wait Lync.exe /Install /Silent start /wai ...

  9. 一百一十二:CMS系统之前台用户模型

    安装shortuuid用于前台用户的主键:pip install shortuuid 创建模型 from datetime import datetimeimport enumfrom werkzeu ...

  10. Python实现计算圆周率π的值到任意位的方法示例

    Python实现计算圆周率π的值到任意位的方法示例 本文实例讲述了Python实现计算圆周率π的值到任意位的方法.分享给大家供大家参考,具体如下: 一.需求分析 输入想要计算到小数点后的位数,计算圆周 ...