08.存储Cinder→5.场景学习→02.Create Volume→3.cinder-volume的处理过程

描述 详细
  1. 查看日志,与 cinder-api 和 cinder-scheduler 执行方式类似,cinder-volume 也启动了一个 Flow 来完成 volume 创建工作,Flow 的名称为 volume_create_manager。
1
2
3
4
5
Jun 11 16:51:15 controller cinder-volume[29999]: 
DEBUG cinder.volume.manager [None req-a6c9fadb-0364-43da-bbf0-d333c549aa74 admin None] 
Flow 'volume_create_manager' (47f4261d-b806-421b-ba0b-3a8d632c5483) 
transitioned into state 'RUNNING' from state 'PENDING' 
{{(pid=30229) _flow_receiver /usr/local/lib/python2.7/dist-packages/taskflow/listeners/logging.py:145
    1. volume_create_manager 首先执行 ExtractVolumeRefTask, OnFailureRescheduleTask, ExtractVolumeSpecTask, NotifyVolumeActionTask 来为 volume 创建做准备。它们的源码位置位于
      1
      2
      3
      /opt/stack/cinder/cinder
      /volume/flows/manager
      /create_volume.py

1
2
3
4
5
Jun 11 16:51:15 controller cinder-volume[29999]: 
DEBUG cinder.volume.manager [None req-a6c9fadb-0364-43da-bbf0-d333c549aa74 admin None] 
Task 'cinder.volume.flows.manager.create_volume.ExtractVolumeRefTask;volume:create' 
(3490974d-592b-43dd-a1c2-b27dc16810a6) transitioned into state 'RUNNING' from state 'PENDING' 
{{(pid=30229) _task_receiver /usr/local/lib/python2.7/dist-packages/taskflow/listeners/logging.py:194
1
2
3
4
5
Jun 11 16:51:16 controller cinder-volume[29999]: 
DEBUG cinder.volume.manager [None req-a6c9fadb-0364-43da-bbf0-d333c549aa74 admin None]
 Task 'cinder.volume.flows.manager.create_volume.ExtractVolumeRefTask;volume:create' 
(3490974d-592b-43dd-a1c2-b27dc16810a6) transitioned into state 'SUCCESS' from state 'RUNNING'  
{{(pid=30229) _task_receiver /usr/local/lib/python2.7/dist-packages/taskflow/listeners/logging.py:183
Extracts volume reference for given volume id  
1
2
3
4
5
Jun 11 16:51:16 controller cinder-volume[29999]: 
DEBUG cinder.volume.manager [None req-a6c9fadb-0364-43da-bbf0-d333c549aa74 admin None] 
Task 'cinder.volume.flows.manager.create_volume.OnFailureRescheduleTask;volume:create' 
(449b4b47-d536-4216-8881-21e1b4e7ef8b) transitioned into state 'RUNNING' from state 'PENDING' 
{{(pid=30229) _task_receiver /usr/local/lib/python2.7/dist-packages/taskflow/listeners/logging.py:194
1
2
3
4
5
Jun 11 16:51:16 controller cinder-volume[29999]: 
DEBUG cinder.volume.manager [None req-a6c9fadb-0364-43da-bbf0-d333c549aa74 admin None] 
Task 'cinder.volume.flows.manager.create_volume.OnFailureRescheduleTask;volume:create' 
(449b4b47-d536-4216-8881-21e1b4e7ef8b) transitioned into state 'SUCCESS' from state 'RUNNING' ...
{{(pid=30229) _task_receiver /usr/local/lib/python2.7/dist-packages/taskflow/listeners/logging.py:183
Triggers a rescheduling request to be sent when reverting occurs. 在恢复发生时,触发重新scheduling请求
1
2
3
4
5
Jun 11 16:51:16 controller cinder-volume[29999]: 
DEBUG cinder.volume.manager [None req-a6c9fadb-0364-43da-bbf0-d333c549aa74 admin None] 
Task 'cinder.volume.flows.manager.create_volume.ExtractVolumeSpecTask;volume:create' 
(d66351f6-0906-4800-83af-c37087a8ef20) transitioned into state 'RUNNING' from state 'PENDING' 
{{(pid=30229) _task_receiver /usr/local/lib/python2.7/dist-packages/taskflow/listeners/logging.py:194
1
2
3
4
5
Jun 11 16:51:16 controller cinder-volume[29999]: 
DEBUG cinder.volume.manager [None req-a6c9fadb-0364-43da-bbf0-d333c549aa74 admin None] 
Task 'cinder.volume.flows.manager.create_volume.ExtractVolumeSpecTask;volume:create' 
(d66351f6-0906-4800-83af-c37087a8ef20) transitioned into state 'SUCCESS' from state 'RUNNING' ... 
{{(pid=30229) _task_receiver /usr/local/lib/python2.7/dist-packages/taskflow/listeners/logging.py:183
Extracts a spec of a volume to be created into a common structure
1
2
3
4
5
Jun 11 16:51:16 controller cinder-volume[29999]: 
DEBUG cinder.volume.manager [None req-a6c9fadb-0364-43da-bbf0-d333c549aa74 admin None] 
Task 'cinder.volume.flows.manager.create_volume.NotifyVolumeActionTask;volume:create, create.start' 
(c8c7b578-72c1-4bcb-9723-ec31b53c9097) transitioned into state 'RUNNING' from state 'PENDING' 
{{(pid=30229) _task_receiver /usr/local/lib/python2.7/dist-packages/taskflow/listeners/logging.py:194
1
2
3
4
5
Jun 11 16:51:16 controller cinder-volume[29999]: 
DEBUG cinder.volume.manager [None req-a6c9fadb-0364-43da-bbf0-d333c549aa74 admin None] 
Task 'cinder.volume.flows.manager.create_volume.NotifyVolumeActionTask;volume:create, create.start' 
(c8c7b578-72c1-4bcb-9723-ec31b53c9097) transitioned into state 'SUCCESS' from state 'RUNNING' ...
{{(pid=30229) _task_receiver /usr/local/lib/python2.7/dist-packages/taskflow/listeners/logging.py:183
Performs a notification about the given volume when called
  1. 接下来 CreateVolumeFromSpecTask 执行 volume 创建任务Creates a volume from a provided specification
1
2
3
4
5
Jun 11 16:51:16 controller cinder-volume[29999]: 
DEBUG cinder.volume.manager [None req-a6c9fadb-0364-43da-bbf0-d333c549aa74 admin None] 
Task 'cinder.volume.flows.manager.create_volume.CreateVolumeFromSpecTask;volume:create' 
(3fa20d37-5784-42a6-888f-6d801ef59072) transitioned into state 'RUNNING' from state 'PENDING' 
{{(pid=30229) _task_receiver /usr/local/lib/python2.7/dist-packages/taskflow/listeners/logging.py:194
1
2
3
4
Jun 11 16:51:16 controller cinder-volume[29999]: 
INFO cinder.volume.flows.manager.create_volume [None req-a6c9fadb-0364-...] 
Volume 1ab8967e-45fb-4ff4-941f-2f1293bdc031: being created as raw with specification: 
{'status': u'creating', 'volume_size': 1, 'volume_name': u'volume-1ab8967e-45fb-4ff4-941f-2f1293bdc031'}
1
2
3
4
5
6
Jun 11 16:51:16 controller cinder-volume[29999]: 
DEBUG oslo_concurrency.processutils [None req-a6c9fadb-0364-43da-bbf0-d333c549aa74 admin None] 
Running cmd (subprocess): sudo cinder-rootwrap /etc/cinder/rootwrap.conf env LC_ALL=C lvcreate 
-T -V 1g -n volume-1ab8967e-45fb-4ff4-941f-2f1293bdc031 
stack-volumes-lvmdriver-1/stack-volumes-lvmdriver-1-pool 
{{(pid=30229) execute /usr/local/lib/python2.7/dist-packages/oslo_concurrency/processutils.py:372
1
2
3
4
5
Jun 11 16:51:29 controller cinder-volume[29999]: 
DEBUG cinder.volume.manager [None req-a6c9fadb-0364-43da-bbf0-d333c549aa74 admin None] 
Task 'cinder.volume.flows.manager.create_volume.CreateVolumeFromSpecTask;volume:create' 
(3fa20d37-5784-42a6-888f-6d801ef59072) transitioned into state 'SUCCESS' from state 'RUNNING' ... 
{{(pid=30229) _task_receiver /usr/local/lib/python2.7/dist-packages/taskflow/listeners/logging.py:183
  1. 因为 volume provider 为 LVM, CreateVolumeFromSpecTask 通过 lvcreate 命令在 VG stack-volumes-lvmdriver-1 中创建了一个 1G 的 LV,cinder-volume 将这个 LV 作为volume。 新创建的 LV 命名为“volume-1ab8967e-45fb-4ff4-941f-2f1293bdc031”,其格式为“volume-<volume ID>”。
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
[email protected]:~# cinder list
+--------------------------------------+-----------+-------+------+-------------+----------+-------------+
| ID                                   | Status    | Name  | Size | Volume Type | Bootable | Attached to |
+--------------------------------------+-----------+-------+------+-------------+----------+-------------+
| 1ab8967e-45fb-4ff4-941f-2f1293bdc031 | available | vol-1 | 1    | lvmdriver-1 | false    |             |
+--------------------------------------+-----------+-------+------+-------------+----------+-------------+
[email protected]:~# lvdisplay
  --- Logical volume ---
  LV Name                stack-volumes-lvmdriver-1-pool
  VG Name                stack-volumes-lvmdriver-1
  LV UUID                ww01ba-CepW-YeCG-RHfk-g0w4-oZfk-NQlmq9
  LV Write Access        read/write
  LV Creation host, time controller, 2019-06-08 12:16:27 +0800
  LV Pool metadata       stack-volumes-lvmdriver-1-pool_tmeta
  LV Pool data           stack-volumes-lvmdriver-1-pool_tdata
  LV Status              available
  # open                 2
  LV Size                22.80 GiB
  Allocated pool data    0.00%
  Allocated metadata     10.51%
  Current LE             5837
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:2
   
  --- Logical volume ---
  LV Path                /dev/stack-volumes-lvmdriver-1/volume-1ab8967e-45fb-4ff4-941f-2f1293bdc031
  LV Name                volume-1ab8967e-45fb-4ff4-941f-2f1293bdc031
  VG Name                stack-volumes-lvmdriver-1
  LV UUID                YeeBPY-aEWW-lTwO-zMua-l7b8-edVu-Q1Sdrz
  LV Write Access        read/write
  LV Creation host, time controller, 2019-06-11 16:51:25 +0800
  LV Pool name           stack-volumes-lvmdriver-1-pool
  LV Status              available
  # open                 0
  LV Size                1.00 GiB
  Mapped size            0.00%
  Current LE             256
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:4
第一个Logical volume是安装完devstack就带的
  1. 最后,CreateVolumeOnFinishTask 完成扫尾工作On successful volume creation this will perform final volume actions
1
2
3
4
5
Jun 11 16:51:29 controller cinder-volume[29999]: 
DEBUG cinder.volume.manager [None req-a6c9fadb-0364-43da-bbf0-d333c549aa74 admin None] 
Task 'cinder.volume.flows.manager.create_volume.CreateVolumeOnFinishTask;volume:create, create.end' 
(7b0b8d49-a629-4cde-a58b-f2d465399eec) transitioned into state 'RUNNING' from state 'PENDING' 
{{(pid=30229) _task_receiver /usr/local/lib/python2.7/dist-packages/taskflow/listeners/logging.py:194
1
2
3
4
5
Jun 11 16:51:29 controller cinder-volume[29999]: 
DEBUG cinder.volume.manager [None req-a6c9fadb-0364-43da-bbf0-d333c549aa74 admin None] 
Task 'cinder.volume.flows.manager.create_volume.CreateVolumeOnFinishTask;volume:create, create.end' 
(7b0b8d49-a629-4cde-a58b-f2d465399eec) transitioned into state 'SUCCESS' from state 'RUNNING' 
{{(pid=30229) _task_receiver /usr/local/lib/python2.7/dist-packages/taskflow/listeners/logging.py:183
  1. 至此,volume 成功创建,Flow volume_create_manager 结束。
1
2
3
4
5
Jun 11 16:51:29 controller cinder-volume[29999]: 
DEBUG cinder.volume.manager [None req-a6c9fadb-0364-43da-bbf0-d333c549aa74 admin None] 
Flow 'volume_create_manager' (47f4261d-b806-421b-ba0b-3a8d632c5483) 
transitioned into state 'SUCCESS' from state 'RUNNING' 
{{(pid=30229) _flow_receiver /usr/local/lib/python2.7/dist-packages/taskflow/listeners/logging.py:145
  1. 查看dashboard

猜你喜欢

转载自www.cnblogs.com/LeisureZhao/p/11185447.html
0条评论
添加一条新回复