返回总目录

1.在创建volume时将所有的日志都实时打开以便记笔记

2.在运行完创建volume的过程,停掉xshell,否则由于xshell显示屏有数量限制,新生成的日志会冲掉之前的日志。而且日志本身也有大小限制,时间
太久的日志也会丢失。
描述 详细
  1. 客户(可以是 OpenStack最终用户,也可以是其他程序)向 cinder-api发送请求:“帮我创建一个 volume。GUI 上操作的菜单为 Project -> Volumes -> Volumes -> Create Volume

    1. 设置 volume 的名称,volume type,大小,Availability Zone 等基本信息
    2. 这里我们没有设置 Volume Source,这样会创建一个空白的 volume。
  1. 查看 cinder-api 日志仅摘录重要的日志,后同 :

    1. cinder-api 接收到一个 POST 类型的 REST API,经过对 HTTP body 的分析,该请求是:创建一个 1GB 的 volume。
1
2
3

Jun 11 16:51:13 controller devstack@c-api.service[28558]: INFO cinder.api.openstack.wsgi [None req-4111af2f-99a8-4166-8647-569b038786d9 admin admin] //192.168.32.73/volume/v3/20c966be6e644bdfa8858d7940d0781f/volumes

1.WSGI是Web Server Gateway Interface的缩写

当使用RESTful web服务的时候:GET用于从服务器取回数据;POST请求通常用来创建一个实体;PUT请求和POST请求类似,但是一般用来更新一个已有的实体;DELETE方法用来从服务器上删除资源;HEAS请求和GET请求资源类似,但是仅仅返回响应的头部(没有具体的响应体)
2.http://192.168.32.73/volume/v3/20c966be6e644bdfa8858d7940d0781f/volumes可以通过openstack endpoint list查到
1
2
3
4
5

Jun 11 16:51:13 controller devstack@c-api.service[28558]: DEBUG cinder.api.v3.volumes [None req-4111af2f-99a8-4166-8647-569b038786d9 admin admin] : {u'volume': {u'status': u'creating', u'size': 1, u'backup_id':
None, u'user_id': None, u'name': u'vol-1', u'imageRef': None, u'availability_zone': u'nova',
...

1
2
3

Jun 11 16:51:13 controller devstack@c-api.service[28558]: INFO cinder.api.v3.volumes [None req-4111af2f-99a8-4166-8647-569b038786d9 admin admin] 

  1. 紧接着,cinder-api 启动了一个 Flow(工作流)volume_create_api。 Flow 的执行状态依次为 PENDING, RUNNING 和 SUCCESS。volume_create_api 当前的状态由 PENDING 变为 RUNNING。
1
2
3
4
5

Jun 11 16:51:13 controller devstack@c-api.service[28558]: DEBUG cinder.volume.api [None req-4111af2f-99a8-4166-8647-569b038786d9 admin admin]  (3c60509d-1a85-43c9-96fb-be0a949d0eea) transitioned into state  from state 'PENDING' {{(pid=28564) _flow_receiver
/usr/local/lib/python2.7/dist-packages/taskflow/listeners/logging.py:145

当执行工作流时,就会调用/usr/local/lib/python2.7/dist-packages/taskflow/listeners/logging.py文件中的_flow_receiver函数

  1. volume_create_api 工作流包含若干 Task,每个 Task 完成特定的任务。 这些任务依次为 ExtractVolumeRequestTask, QuotaReserveTask, EntryCreateTask, QuotaCommitTask, VolumeCastTask,这几个任务在源码中都是类,在源码中的位置是

    1
    2

    /opt/stack/cinder/cinder/volume/flows/api/create_volume.py

    。 Task 的执行状态也会经历 PENDING, RUNNING 和 SUCCESS 三个阶段

  1. ExtractVolumeRequestTask 获取 request 信息Processes an api request values into a validated set of values.(将api请求值处理为经过验证的值集。)
1
2
3
4
5

Jun 11 16:51:13 controller devstack@c-api.service[28558]: DEBUG cinder.volume.api [None req-4111af2f-99a8-4166-8647-569b038786d9 admin admin] Task 'cinder.volume.flows.api.create_volume.;volume:create' (4865720e-3012-4135-8683-e14e5ac151f9) transitioned into state  from state 'PENDING'
{{(pid=28564) _task_receiver /usr/local/lib/python2.7/dist-packages/taskflow/listeners/logging.py:194

当执行task时,就会调用/usr/local/lib/python2.7/dist-packages/taskflow/listeners/logging.py文件中的_task_receiver函数

1
2
3
4
5
6
7

Jun 11 16:51:13 controller devstack@c-api.service[28558]: DEBUG cinder.volume.api [None req-4111af2f-99a8-4166-8647-569b038786d9 admin admin] Task  (4865720e-3012-4135-8683-e14e5ac151f9) transitioned into state  from state 'RUNNING' with result '{'volume_type_id': u'e3695232-2b2d-4e2d-a184-1bcde93cd8fa', 'backup_id': None, ...
{{(pid=28564) _task_receiver /usr/local/lib/python2.7/dist-packages/taskflow/listeners/logging.py:183

  1. QuotaReserveTask 预留配额   ˈkwoʊtə 定量;定额;配额(分配的数额)    Reserves a single volume with the given size & the given volume type(用给定大小和给定卷类型预留单个卷)
1
2
3
4
5

Jun 11 16:51:13 controller devstack@c-api.service[28558]: DEBUG cinder.volume.api [None req-4111af2f-99a8-4166-8647-569b038786d9 admin admin] Task 'cinder.volume.flows.api.create_volume.;volume:create' ...transitioned into state  from state 'PENDING' {{(pid=28564)
_task_receiver /usr/local/lib/python2.7/dist-packages/taskflow/listeners/logging.py:194

1
2
3
4

Jun 11 16:51:14 controller devstack@c-api.service[28558]: DEBUG cinder.quota [None req-4111af2f-99a8-4166-8647-569b038786d9 admin admin]  ['ca6af98f-f4fc-4798-b457-0c80cd44fb80', ...
{{(pid=28564) reserve /opt/stack/cinder/cinder/quota.py:1029

1
2
3
4
5
6

Jun 11 16:51:14 controller devstack@c-api.service[28558]: DEBUG cinder.volume.api [None req-4111af2f-99a8-4166-8647-569b038786d9 admin admin] Task  ...transitioned into state  from state 'RUNNING' with result '{'reservations': ['ca6af98f-f4fc-4798-b457-0c80cd44fb80', ... _task_receiver /usr/local/lib/python2.7/dist-packages/taskflow/listeners/logging.py:183

  1. EntryCreateTask 在数据库中创建 volume 条目Creates an entry for the given volume creation in the database
1
2
3
4
5

Jun 11 11:51:14 controller devstack@c-api.service[28558]: DEBUG cinder.volume.api [None req-4111af2f-99a8-4166-8647-569b038786d9 admin admin] Task 'cinder.volume.flows.api.create_volume.;volume:create' ... transitioned into state  from state 'PENDING' {{(pid=28564)
_task_receiver /usr/local/lib/python2.7/dist-packages/taskflow/listeners/logging.py:194

1
2
3
4

Jun 11 11:51:14 controller devstack@c-api.service[28558]: DEBUG cinder.volume.api [None req-4111af2f-99a8-4166-8647-569b038786d9 admin admin] Task 'cinder.volume.flows.api.create_volume.;volume:create' ... transitioned into state  from state 'RUNNING' with result ...

  1. QuotaCommitTask 确认配额 Commits the reservation
1
2
3
4
5

Jun 11 11:51:14 controller devstack@c-api.service[28558]: DEBUG cinder.volume.api [None req-4111af2f-99a8-4166-8647-569b038786d9 admin admin] Task 'cinder.volume.flows.api.create_volume.;volume:create' ...transitioned into state  from state 'PENDING' {{(pid=28564)
_task_receiver /usr/local/lib/python2.7/dist-packages/taskflow/listeners/logging.py:194

1
2
3
4
5

Jun 11 11:51:14 controller devstack@c-api.service[28558]: DEBUG cinder.volume.api [None req-4111af2f-99a8-4166-8647-569b038786d9 admin admin] Task  ...transitioned into state  from state 'RUNNING' with result '{'volume_properties': ...
{{(pid=28564) _task_receiver /usr/local/lib/python2.7/dist-packages/taskflow/listeners/logging.py:183

  1. 最后 VolumeCastTask 是向 cinder-sheduler 发送消息,开始调度工作   Performs a volume create cast to the scheduler or to the volume manager
1
2
3
4
5

Jun 11 11:51:14 controller devstack@c-api.service[28558]: DEBUG cinder.volume.api [None req-4111af2f-99a8-4166-8647-569b038786d9 admin admin] Task 'cinder.volume.flows.api.create_volume.VolumeCastTask;:create' ...transitioned into state  from state 'PENDING' {{(pid=28564)
_task_receiver /usr/local/lib/python2.7/dist-packages/taskflow/listeners/logging.py:194

1
2
3
4
5

Jun 11 11:51:14 controller devstack@c-api.service[28558]: DEBUG cinder.volume.api [None req-4111af2f-99a8-4166-8647-569b038786d9 admin admin] Task 'cinder.volume.flows.api.create_volume.;volume:create' ... transitioned into state  from state 'RUNNING' with result 'None' {{(pid=28564)
_task_receiver /usr/local/lib/python2.7/dist-packages/taskflow/listeners/logging.py:183

  1. 至此,Flow volume_create_api 已经完成,状态由 RUNNING 变为 SUCCESS,创建volume 请求成功发布cinder-api 已经成功处理了 volume create 请求,将消息发给了 cinder-scheduler
1
2
3
4
5

Jun 11 11:51:14 controller devstack@c-api.service[28558]: DEBUG cinder.volume.api [None req-4111af2f-99a8-4166-8647-569b038786d9 admin admin]  (3c60509d-1a85-43c9-96fb-be0a949d0eea) transitioned into state  from state 'RUNNING'
{{(pid=28564) _flow_receiver /usr/local/lib/python2.7/dist-packages/taskflow/listeners/logging.py:145

1
2
3

Jun 11 11:51:14 controller devstack@c-api.service[28558]: INFO cinder.volume.api [None req-4111af2f-99a8-4166-8647-569b038786d9 admin admin] 

  1. cinder-api 向 RabbitMQ 发送了一条消息:“让cinder-scheduler 创建一个 volume”,消息是由 VolumeCastTask 发出的,因为 VolumeCastTask 没有打印相关日志,我们只能通过源代码查看 /opt/stack/cinder/cinder/volume/flows/api/create_volume.py ,方法为 create_volume。
 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

class VolumeCastTask(flow_utils.CinderTask):"""Performs a volume create cast to the scheduler or to the volume manager.

This will signal a transition of the api workflow to another child and/or
related workflow on another component.

Reversion strategy: rollback source volume status and error out newly
created volume.
"""
#...
def _cast_create_volume(self, context, request_spec, filter_properties):
#...
self.scheduler_rpcapi.create_volume(
context,
volume,
snapshot_id=snapshot_id,
image_id=image_id,
request_spec=request_spec,
filter_properties=filter_properties,
backup_id=backup_id)
#...

如果我们需要将一个函数运行在远程计算机上并且等待从那儿获取结果时,该怎么办呢?这就是另外的故事了。这种模式通常被称为远程过程调用(Remote Procedure Call)或者 RPC,使用 RabbitMQ 来构建一个 RPC 系统

08.存储Cinder→5.场景学习→02.Create Volume→1.cinder-api处理过程相关推荐

  1. 08.存储Cinder→5.场景学习→10.Bootable Volume

    返回总目录 背景: 描述 详细 Volume 除了可以用作 instance 的数据盘,也可以作为启动盘(Bootable Volume).创建Volume,此时选择Volume Source为ima ...

  2. 08.存储Cinder→4.Cinder组件详解→3.cinder-volume

    返回总目录 cinder-volume 在存储节点上运行,OpenStack 对 Volume 的操作,最后都是交给 cinder-volume 来完成的.cinder-volume 自身并不管理真正 ...

  3. Matlab GUI学习02:使用GUIDE开发图形界面程序

    pdf版本笔记的下载地址: Matlab GUI学习02_使用GUIDE开发图形界面程序(访问密码:3834) Matlab GUI学习02:使用GUIDE开发图形界面程序 GUIDE GUIDE简介 ...

  4. Python 学习 02 —— Python如何爬取数据

    文章目录 系列文章 二.Python 爬 虫 1.任务介绍 2.简介 3.基本流程 3.1.准备工作 3.1.1.分析页面 3.1.2.编码规范 3.1.3.导入模块 3.1.4.程序流程 3.2.获 ...

  5. java虚拟机预先加载哪些类_Java虚拟机JVM学习02 类的加载概述

    Java虚拟机JVM学习02 类的加载概述 类的加载 类的加载指的是将类的.class文件中的二进制数据读入到内存中,将其放在运行时数据区的方法区内,然后在堆区创建一个java.lang.Class对 ...

  6. C++模板学习02(类模板)(类模板语法、类模板与函数模板的区别、类模板中的成员函数创建时机、类模板对象做函数参数、类模板与继承、类模板成员函数类外实现、类模板分文件编写、类模板与友元)

    C++引用详情(引用的基本语法,注意事项,做函数的参数以及引用的本质,常量引用) 函数高级C++(函数的默认参数,函数的占位参数,函数重载的基本语法以及注意事项) C++类和对象-封装(属性和行为作为 ...

  7. Blender创建三维教室场景学习教程 3D Classroom Environment Creation in Blender

    流派:电子学习| MP4 |视频:h264,1280×720 |音频:AAC,48.0 KHz 语言:英语+中英文字幕(根据原英文字幕机译更准确)|大小解压后:3.73 GB 含课程文件 |时长:4h ...

  8. 在UE5创造一个多山的松树森林场景学习教程

    UE5游戏场景设计制作视频教程 大小解压后:4.37G 1920X1080 mp4 语言:英语+中英字幕(机译)时长:5小时 20分 课程获取:在UE5创造一个多山的松树森林场景学习教程

  9. Blender从头到尾创建一个低多边形场景学习教程

    Low Poly Landscapes – Blender Bite Sized Course 流派:电子学习| MP4 |视频:h264,1280×720 |音频:AAC,48.0 KHz 语言:英 ...

  10. 微信小程序_基础组件学习02

    微信小程序_基础组件学习02 swiper组件 swiper是滑块容器,也就是手机端的轮播图. swiper组件有两部分组成swiper和swiper-item. swiper-item需要放在swi ...

最新文章

  1. 【工业智能】人工智能真的无所不能吗?
  2. Linking Containers Together
  3. PHP实进程池,swoole_process实现进程池的方法示例
  4. SM_INTEGRATION_SRV
  5. JDBC中Statement与PreparedStatement的区别
  6. 玩转MySQL之Linux下的简单操作(服务启动与关闭、启动与关闭、查看版本)
  7. cygwin下的gcc-4.7.1编译心得
  8. 工作流实战_20_flowable 任务签收 反签收
  9. Linux——SSH服务器
  10. 《天天数学》连载39:二月八日
  11. Python学习:day21正则表达式
  12. SpringCloud微服务详细流程
  13. 网站服务器、VPS和虚拟主机的联系与区别
  14. linux服务器终止进程,结束linux 服务器系统中一个程序的多个进程
  15. Beyond compare vs kdiff3
  16. stream筛选出集合中对象属性重复值
  17. Python小结<1>
  18. Docker下centos7镜像安装中文支持
  19. 林斯坦 小学生学计算机,技术支持下的小学生数学有意义学习研究.doc
  20. 算法总结——大整数乘法

热门文章

  1. 对计算机硬盘进行格式化时,在安装操作系统之前,如何对硬盘进行分区和格式化(新手必看)...
  2. 肖哥所有课程/HCNA HCNP/安全/云计算/虚拟化/linux/视频教程/资料软件下载链接
  3. 5G无线技术基础自学系列 | 5G基站形态演进
  4. android 拦截qq消息,[Android] QNotified_v0.7.1-beta_QQ辅助增强XP模块【可屏蔽下拉小程序/屏蔽@全体/消息防撤回】...
  5. 图像处理——SIFT算法
  6. 仓库管理系统数据库设计
  7. git clone出错
  8. 物联网工程导论 简单整理
  9. Fortify代码扫描工具
  10. 基于微信小程序的学生活动管理系统的设计与实现