next up previous contents
Next: Quantum 網路服務 Up: Glusterfs 檔案系統 Previous: Gluster Client 新增 cinder   Contents

使用 Glusterfs volume

  1. 載入管理者環境變數。
    [root@kvm4 ~]# source keystonerc_admin 
    [root@kvm4 ~(keystone_admin)]#
    
  2. 查看 cinder type。
    [root@kvm4 ~(keystone_admin)]# cinder type-list
    +--------------------------------------+------+
    |                  ID                  | Name |
    +--------------------------------------+------+
    | d6b9ab23-819f-41fd-8779-4b1a4163058c | lvm  |
    +--------------------------------------+------+
    
  3. 如果 lvm 不存在,就產生 cinder volume 儲存後端,type 為 lvm。
    [root@kvm4 ~(keystone_admin)]# cinder type-create lvm
    +--------------------------------------+------+
    |                  ID                  | Name |
    +--------------------------------------+------+
    | d6b9ab23-819f-41fd-8779-4b1a4163058c | lvm  |
    +--------------------------------------+------+
    
  4. 設定 type lvm 的後台名稱為 LVM。
    [root@kvm4 ~(keystone_admin)]# cinder type-key lvm set volume_backend_name=LVM
    
  5. 產生 cinder volume 儲存後端,type 為 glusterfs。
    [root@kvm4 ~(keystone_admin)]# cinder type-create glusterfs
    +--------------------------------------+-----------+
    |                  ID                  |    Name   |
    +--------------------------------------+-----------+
    | 7960b2ca-9bed-4aee-860b-856a3a366f00 | glusterfs |
    +--------------------------------------+-----------+
    
  6. 設定 type glusterfs 的後台名稱為 RHS。
    [root@kvm4 ~(keystone_admin)]# cinder type-key glusterfs set volume_backend_name=RHS
    
  7. 確認 cinder type 包含 lvm 及 glusterfs。
    [root@kvm4 ~(keystone_admin)]# cinder type-list
    +--------------------------------------+-----------+
    |                  ID                  |    Name   |
    +--------------------------------------+-----------+
    | 7960b2ca-9bed-4aee-860b-856a3a366f00 | glusterfs |
    | d6b9ab23-819f-41fd-8779-4b1a4163058c |    lvm    |
    +--------------------------------------+-----------+
    
  8. 在 lvm 儲存後端,產生 1G 空間,名稱 vol2。
    [root@kvm4 ~(keystone_admin)]# cinder create --volume-type lvm --display-name vol2 1
    +---------------------+--------------------------------------+
    |       Property      |                Value                 |
    +---------------------+--------------------------------------+
    |     attachments     |                  []                  |
    |  availability_zone  |                 nova                 |
    |       bootable      |                false                 |
    |      created_at     |      2014-01-25T02:12:07.088789      |
    | display_description |                 None                 |
    |     display_name    |                 vol2                 |
    |          id         | bd1a2e7f-ca81-46ae-b8c4-e20269b53370 |
    |       metadata      |                  {}                  |
    |         size        |                  1                   |
    |     snapshot_id     |                 None                 |
    |     source_volid    |                 None                 |
    |        status       |               creating               |
    |     volume_type     |                 lvm                  |
    +---------------------+--------------------------------------+
    
  9. 確認 vol2。
    [root@kvm4 ~(keystone_admin)]# cinder list
    +--------------------------------------+-----------+--------------+------+-------------+----------+-------------+
    |                  ID                  |   Status  | Display Name | Size | Volume Type | Bootable | Attached to |
    +--------------------------------------+-----------+--------------+------+-------------+----------+-------------+
    | bd1a2e7f-ca81-46ae-b8c4-e20269b53370 | available |     vol2     |  1   |     lvm     |  false   |             |
    +--------------------------------------+-----------+--------------+------+-------------+----------+-------------+
    
  10. 在 glusterfs 儲存後端,產生 1G 空間,名稱 vol3。
    [root@kvm4 ~(keystone_admin)]# cinder create --volume-type glusterfs --display-name vol3 1
    +---------------------+--------------------------------------+
    |       Property      |                Value                 |
    +---------------------+--------------------------------------+
    |     attachments     |                  []                  |
    |  availability_zone  |                 nova                 |
    |       bootable      |                false                 |
    |      created_at     |      2014-01-25T02:14:34.716899      |
    | display_description |                 None                 |
    |     display_name    |                 vol3                 |
    |          id         | a5f7637f-780d-4004-84e2-4cfa2c396c35 |
    |       metadata      |                  {}                  |
    |         size        |                  1                   |
    |     snapshot_id     |                 None                 |
    |     source_volid    |                 None                 |
    |        status       |               creating               |
    |     volume_type     |              glusterfs               |
    +---------------------+--------------------------------------+
    
  11. 確認 vol3。
    [root@kvm4 ~(keystone_admin)]# cinder list
    +--------------------------------------+-----------+--------------+------+-------------+----------+-------------+
    |                  ID                  |   Status  | Display Name | Size | Volume Type | Bootable | Attached to |
    +--------------------------------------+-----------+--------------+------+-------------+----------+-------------+
    | a5f7637f-780d-4004-84e2-4cfa2c396c35 | available |     vol3     |  1   |  glusterfs  |  false   |             |
    | bd1a2e7f-ca81-46ae-b8c4-e20269b53370 | available |     vol2     |  1   |     lvm     |  false   |             |
    +--------------------------------------+-----------+--------------+------+-------------+----------+-------------+
    
  12. 移除 vol2 及 vol3。
    [root@kvm4 ~(keystone_admin)]# cinder delete vol2
    [root@kvm4 ~(keystone_admin)]# cinder delete vol3
    
  13. 列出 cinder 為空。
    [root@kvm4 ~(keystone_admin)]# cinder list
    [root@kvm4 ~(keystone_admin)]#
    


2015-12-29