openstack组件之cinder

1、块存储服务

    块存储服务提供对 volume 从创建到删除整个生命周期的管理

    从 instance 的角度看,挂载的每一个 Volume 都是一块硬盘。

    OpenStack 提供 Block Storage Service 的是 Cinder,其具体功能是:

    提供 REST API 使用户能够查询和管理 volume、volume snapshot 以及 volume type

    提供 scheduler 调度 volume 创建请求,合理优化存储资源的分配

    通过 driver 架构支持多种 back-end(后端)存储方式,包括 LVM,NFS,Ceph 和其他诸如 EMC、IBM 等商业存储产品和方案


2、cinder架构

1)cinder-api 

    接收 API 请求,调用 cinder-volume 执行操作。

2)cinder-volume

    管理 volume 的服务,与 volume provider协调工作,管理 volume 的生命周期。运行 cinder-volume 服务的节点被称作为存储节点。

3)cinder-scheduler 

    scheduler 通过调度算法选择最合适的存储节点创建 volume。

4)volume provider 

    数据的存储设备,为 volume 提供物理存储空间。 

    cinder-volume 支持多种 volume provider,每种 volume provider 通过自己的 driver 与cinder-volume 协调工作。

5)Message Queue 

    Cinder 各个子服务通过消息队列实现进程间通信和相互协作。因为有了消息队列,子服务之间实现了解耦,这种松散的结构也是分布式系统的重要特征。

6)Database 

    Cinder 有一些数据需要存放到数据库中,一般使用 MySQL。数据库是安装在控制节点上的


3、物理部署方案

    cinder 的服务会部署在两类节点上,控制节点和存储节点。 

    cinder-api 和 cinder-scheduler 部署在控制节点上。

    cinder-volume 在存储节点上。

    RabbitMQ 和 MySQL 通常部署在控制节点上。

    volume provider 一般来讲是独立的。

    cinder-volume 使用 driver 与 volume provider 通信并协调工作。

    所以只需要将 driver 与 cinder-volume 放到一起就可以了。


4、从 volume 创建流程看 cinder-* 子服务如何协同工作

cinder.png

        1)客户(以是 OpenStack 最终用户,也可以是其他程序)向 API(cinder-api)发送请求:“帮我创建一个 volume”

2)API 对请求做一些必要处理后,向 Messaging(RabbitMQ)发送了一条消息:“让 Scheduler 选择合适的存储节点”

3)Scheduler(cinder-scheduler)从 Messaging 获取到 API 发给它的消息,然后执行调度算法,从若干计存储点中选出节点 A

4)Scheduler 向 Messaging 发送了一条消息:“让存储节点 A 创建这个 volume”

5)存储节点 A 的 Volume(cinder-volume)从 Messaging 中获取到 Scheduler 发给它的消息,然后通过 driver 在 volume provider 上创建 volume。


5、子服务详解

1)cinder-api 

cinder-api对接收到的 HTTP API(Volume 生命周期相关的操作)请求会做如下处理:

检查客户端传人的参数是否合法有效

调用 cinder 其他子服务的处理客户端请求

将 cinder 其他子服务返回的结果序列号并返回给客户端

2)cinder-scheduler

创建Volume时,cinder-scheduler会基于容量、Volume Type等条件选择出最合适的存储节点,然后让其创建Volume

3)cinder-volume

cinder-volume 在存储节点上运行,OpenStack 对 Volume 的操作,最后都是交给 cinder-volume 来完成的。 

cinder-volume 自身并不管理真正的存储设备,存储设备是由 volume provider 管理的。

cinder-volume 与 volume provider 一起实现 volume 生命周期的管理。它们之间是通过driver实现通信。

6、Volume的挂载和卸载

未完待续……


猜你喜欢

转载自blog.51cto.com/10630401/2121717