08.存儲Cinder→5.場景學習→11.NFS Volume Provider→2.Create Volume

描述 詳細
  1. 建立 NFS volume 操做方法與 LVM volume 同樣,惟一區別是在 volume type 的下拉列表中選擇「nfs」。
  2. 點擊「Create Volume」,cinder-api,cinder-scheduler 和 cinder-volume 共同協做建立 volume 「vol-3」。這個流程與 LVM volume 同樣。因爲只有一個存儲節點,所以篩選出的仍是控制節點。
  3. 下面咱們重點分析 cinder-volume 日誌,看看 NFS volume provider 是如何建立 volume 的。 

  1. 查看日誌cinder-volume日誌:
    1. cinder-volume 也會啓動 Flow 來完成 volume 建立工做,Flow 的名稱爲 volume_create_manager。
1
2
3
4
5
6
Jun 24 15:15:29 controller cinder-volume[10526]: 
DEBUG cinder.volume.manager 
[None req-ebb16520-df22-445e-82f7-4c8b8bf942f2 admin None] 
Flow 'volume_create_manager' (ce8afde5-ad68-4b11-b356-e9d0272021ca) 
transitioned into state 'RUNNING' from state 'PENDING' 
{{(pid=10540) _flow_receiver /usr/local/lib/python2.7/dist-packages/taskflow/listeners/logging.py:145
  1. volume_create_manager 首先執行 ExtractVolumeRefTask, OnFailureRescheduleTask, ExtractVolumeSpecTask, NotifyVolumeActionTask 爲 volume建立作準備。而後由 CreateVolumeFromSpecTask 真正建立 volume。
1
2
3
4
5
6
Jun 24 15:15:29 controller cinder-volume[10526]: 
DEBUG cinder.volume.manager 
[None req-ebb16520-df22-445e-82f7-4c8b8bf942f2 admin None] 
Task 'cinder.volume.flows.manager.create_volume.CreateVolumeFromSpecTask;volume:create' 
(13ad3eb3-3d4e-4f9d-87d3-8c60cd4ee1c7) transitioned into state 'RUNNING' from state 'PENDING' 
{{(pid=10540) _task_receiver /usr/local/lib/python2.7/dist-packages/taskflow/listeners/logging.py:194
1
2
3
4
5
Jun 24 15:15:29 controller cinder-volume[10526]: 
INFO cinder.volume.flows.manager.create_volume 
[None req-ebb16520-df22-445e-82f7-4c8b8bf942f2 admin None] 
Volume 588b6bbe-8965-4dcb-ae87-1970b906a847: being created as raw with specification: 
{'status': u'creating', 'volume_size': 1, 'volume_name': u'volume-588b6bbe-8965-4dcb-ae87-1970b906a847'}
  1. 首先 mount 遠程 NFS 目錄掛載到本地
1
2
3
4
5
Jun 24 15:15:29 controller cinder-volume[10526]: 
DEBUG cinder.volume.drivers.remotefs 
[None req-ebb16520-df22-445e-82f7-4c8b8bf942f2 admin None] 
Loading shares from /etc/cinder/nfs_shares. 
{{(pid=10540) _load_shares_config /opt/stack/cinder/cinder/volume/drivers/remotefs.py:499
1
2
3
4
Jun 24 15:15:29 controller cinder-volume[10526]: 
DEBUG cinder.volume.drivers.remotefs 
[None req-ebb16520-df22-445e-82f7-4c8b8bf942f2 admin None] 
shares loaded: {'172.16.1.55:/storage': None}
1
2
3
4
5
6
{{(pid=10540) _load_shares_config /opt/stack/cinder/cinder/volume/drivers/remotefs.py:531
Jun 24 15:15:29 controller cinder-volume[10526]: 
DEBUG oslo_concurrency.processutils 
[None req-ebb16520-df22-445e-82f7-4c8b8bf942f2 admin None] 
Running cmd (subprocess): mount 
{{(pid=10540) execute /usr/local/lib/python2.7/dist-packages/oslo_concurrency/processutils.py:372
1
2
3
4
Jun 24 15:15:29 controller cinder-volume[10526]: 
INFO os_brick.remotefs.remotefs 
[None req-ebb16520-df22-445e-82f7-4c8b8bf942f2 admin None] 
Already mounted: /opt/stack/data/cinder/mnt/784d250b26b539400de552b6137dccd0
  1. 執行stat、du 命令檢查 NFS 目錄。
1
2
3
4
5
6
Jun 24 15:15:29 controller cinder-volume[10526]: 
DEBUG oslo_concurrency.processutils 
[None req-ebb16520-df22-445e-82f7-4c8b8bf942f2 admin None] 
Running cmd (subprocess): sudo cinder-rootwrap /etc/cinder/rootwrap.conf stat -f -c 
%S %b %a /opt/stack/data/cinder/mnt/784d250b26b539400de552b6137dccd0 
{{(pid=10540) execute /usr/local/lib/python2.7/dist-packages/oslo_concurrency/processutils.py:372
1
2
3
4
5
6
Jun 24 15:15:29 controller cinder-volume[10526]: 
DEBUG oslo_concurrency.processutils 
[None req-ebb16520-df22-445e-82f7-4c8b8bf942f2 admin None] 
Running cmd (subprocess): sudo cinder-rootwrap /etc/cinder/rootwrap.conf du -sb 
--apparent-size --exclude *snapshot* /opt/stack/data/cinder/mnt/784d250b26b539400de552b6137dccd0 
{{(pid=10540) execute /usr/local/lib/python2.7/dist-packages/oslo_concurrency/processutils.py:372
  1. 執行truncate [ˈtrʌŋkeɪt]vt.  縮短; 建立 volume 文件
1
2
3
4
5
Jun 24 15:15:30 controller cinder-volume[10526]: 
DEBUG cinder.volume.drivers.nfs 
[None req-ebb16520-df22-445e-82f7-4c8b8bf942f2 admin None] 
Selected 172.16.1.55:/storage as target NFS share. 
{{(pid=10540) _find_share /opt/stack/cinder/cinder/volume/drivers/nfs.py:263
1
2
3
4
Jun 24 15:15:30 controller cinder-volume[10526]: 
INFO cinder.volume.drivers.remotefs 
[None req-ebb16520-df22-445e-82f7-4c8b8bf942f2 admin None]
 casted to 172.16.1.55:/storage
1
2
3
4
5
6
Jun 24 15:15:30 controller cinder-volume[10526]: 
DEBUG oslo_concurrency.processutils 
[None req-ebb16520-df22-445e-82f7-4c8b8bf942f2 admin None] 
Running cmd (subprocess): sudo cinder-rootwrap /etc/cinder/rootwrap.conf truncate -s 1G 
/opt/stack/data/cinder/mnt/784d250b26b539400de552b6137dccd0/volume-588b6bbe-8965-4dcb-ae87-1970b906a847 
{{(pid=10540) execute /usr/local/lib/python2.7/dist-packages/oslo_concurrency/processutils.py:372
  1. 設置 volume 文件爲可讀寫。
1
2
3
4
5
6
Jun 24 15:15:30 controller cinder-volume[10526]: 
DEBUG oslo_concurrency.processutils 
[None req-ebb16520-df22-445e-82f7-4c8b8bf942f2 admin None] 
Running cmd (subprocess): sudo cinder-rootwrap /etc/cinder/rootwrap.conf chmod ugo+rw 
/opt/stack/data/cinder/mnt/784d250b26b539400de552b6137dccd0/volume-588b6bbe-8965-4dcb-ae87-1970b906a847 
{{(pid=10540) execute /usr/local/lib/python2.7/dist-packages/oslo_concurrency/processutils.py:372
  1. create 操做完成
1
2
3
4
5
6
7
8
Jun 24 15:15:31 controller cinder-volume[10526]: 
DEBUG cinder.volume.manager 
[None req-ebb16520-df22-445e-82f7-4c8b8bf942f2 admin None] 
Task 'cinder.volume.flows.manager.create_volume.CreateVolumeFromSpecTask;volume:create' 
(13ad3eb3-3d4e-4f9d-87d3-8c60cd4ee1c7) transitioned into state 'SUCCESS' from state 'RUNNING' 
with result '{'status': u'creating', 'volume_size': 1, 'volume_name': 
u'volume-588b6bbe-8965-4dcb-ae87-1970b906a847'}' 
{{(pid=10540) _task_receiver /usr/local/lib/python2.7/dist-packages/taskflow/listeners/logging.py:183
1
2
3
4
5
6
Jun 24 15:15:31 controller cinder-volume[10526]: 
DEBUG cinder.volume.manager 
[None req-ebb16520-df22-445e-82f7-4c8b8bf942f2 admin None] 
Task 'cinder.volume.flows.manager.create_volume.CreateVolumeOnFinishTask;volume:create, create.end' 
(c63640e9-ecca-4789-a09a-65a853b1ad8f) transitioned into state 'RUNNING' from state 'PENDING' 
{{(pid=10540) _task_receiver /usr/local/lib/python2.7/dist-packages/taskflow/listeners/logging.py:194
1
2
3
4
5
Jun 24 15:15:31 controller cinder-volume[10526]: 
INFO cinder.volume.flows.manager.create_volume 
[None req-ebb16520-df22-445e-82f7-4c8b8bf942f2 admin None] 
Volume volume-588b6bbe-8965-4dcb-ae87-1970b906a847 (588b6bbe-8965-4dcb-ae87-1970b906a847): created successfully
1
2
3
4
5
6
7
Jun 24 15:15:31 controller cinder-volume[10526]: 
DEBUG cinder.volume.manager 
[None req-ebb16520-df22-445e-82f7-4c8b8bf942f2 admin None] 
Task 'cinder.volume.flows.manager.create_volume.CreateVolumeOnFinishTask;volume:create, 
create.end' (c63640e9-ecca-4789-a09a-65a853b1ad8f) transitioned into state 'SUCCESS' 
from state 'RUNNING' with result 'None' 
{{(pid=10540) _task_receiver /usr/local/lib/python2.7/dist-packages/taskflow/listeners/logging.py:183
1
2
3
4
5
6
Jun 24 15:15:31 controller cinder-volume[10526]: 
DEBUG cinder.volume.manager 
[None req-ebb16520-df22-445e-82f7-4c8b8bf942f2 admin None] 
Flow 'volume_create_manager' (ce8afde5-ad68-4b11-b356-e9d0272021ca) transitioned into state 'SUCCESS' 
from state 'RUNNING' 
{{(pid=10540) _flow_receiver /usr/local/lib/python2.7/dist-packages/taskflow/listeners/logging.py:145
  1. Volume 在 NFS 上以文件存在,命名爲「volume-<volume ID>」。


相關文章
相關標籤/搜索