管理共享

共享是由文件存储提供的。您可以对实例开放存取共享文件的权限。如要创建共享,您可以使用manila命令行客户端。

创建共享网络

  1. 创建共享网络
  1. $ manila share-network-create --name mysharenetwork --description "My Manila network" --neutron-net-id 394246ed-d3fd-4a30-a456-7042ce3429b9 --neutron-subnet-id 8f56d97d-8495-4a5b-8544-9ae4ee9390fc
  2. +-------------------+--------------------------------------+
  3. | Property | Value |
  4. +-------------------+--------------------------------------+
  5. | name | mysharenetwork |
  6. | segmentation_id | None |
  7. | created_at | 2015-08-17T21:13:29.607489 |
  8. | neutron_subnet_id | 8f56d97d-8495-4a5b-8544-9ae4ee9390fc |
  9. | updated_at | None |
  10. | network_type | None |
  11. | neutron_net_id | 394246ed-d3fd-4a30-a456-7042ce3429b9 |
  12. | ip_version | None |
  13. | nova_net_id | None |
  14. | cidr | None |
  15. | project_id | d80a6323e99f4f22a26ad2accd3ec791 |
  16. | id | ccd6b453-8b05-4508-bbce-93bfe660451f |
  17. | description | My Manila network |
  18. +-------------------+--------------------------------------+
  1. 列出共享网络
  1. $ manila share-network-list
  2. +--------------------------------------+----------------+
  3. | id | name |
  4. +--------------------------------------+----------------+
  5. | ccd6b453-8b05-4508-bbce-93bfe660451f | mysharenetwork |
  6. +--------------------------------------+----------------+

创建共享

  1. 创建一份共享
  1. $ manila create --name myshare --description "My Manila share" --share-network ccd6b453-8b05-4508-bbce-93bfe660451f NFS 1
  2. +-------------------+--------------------------------------+
  3. | Property | Value |
  4. +-------------------+--------------------------------------+
  5. | status | creating |
  6. | description | My Manila share |
  7. | availability_zone | nova |
  8. | share_network_id | ccd6b453-8b05-4508-bbce-93bfe660451f |
  9. | export_locations | [] |
  10. | host | None |
  11. | snapshot_id | None |
  12. | is_public | False |
  13. | id | 2fe736d1-08ac-46f9-a482-8f224405f2a7 |
  14. | size | 1 |
  15. | name | myshare |
  16. | share_type | default |
  17. | created_at | 2015-08-17T21:17:23.777696 |
  18. | export_location | None |
  19. | share_proto | NFS |
  20. | project_id | d80a6323e99f4f22a26ad2accd3ec791 |
  21. | metadata | {} |
  22. +-------------------+--------------------------------------+
  1. 显示一份共享的细节
  1. $ manila show 2fe736d1-08ac-46f9-a482-8f224405f2a7
  2. +-------------------+--------------------------------------+
  3. | Property | Value |
  4. +-------------------+--------------------------------------+
  5. | status | creating |
  6. | description | My Manila share |
  7. | availability_zone | nova |
  8. | share_network_id | ccd6b453-8b05-4508-bbce-93bfe660451f |
  9. | export_locations | [] |
  10. | host | ubuntuManila@generic1#GENERIC1 |
  11. | snapshot_id | None |
  12. | is_public | False |
  13. | id | 2fe736d1-08ac-46f9-a482-8f224405f2a7 |
  14. | size | 1 |
  15. | name | myshare |
  16. | share_type | default |
  17. | created_at | 2015-08-17T21:17:23.000000 |
  18. | export_location | None |
  19. | share_proto | NFS |
  20. | project_id | d80a6323e99f4f22a26ad2accd3ec791 |
  21. | metadata | {} |
  22. +-------------------+--------------------------------------+
  1. 列出所有的共享
  1. $ manila list
  2. +--------------------------------------+---------+------+-------------+-----------+-----------+------------+---------------------------------------------------------------+--------------------------------+
  3. | ID | Name | Size | Share Proto | Status | Is Public | Share Type | Export location | Host |
  4. +--------------------------------------+---------+------+-------------+-----------+-----------+------------+---------------------------------------------------------------+--------------------------------+
  5. | 2fe736d1-08ac-46f9-a482-8f224405f2a7 | myshare | 1 | NFS | available | False | default | 10.254.0.3:/shares/share-2fe736d1-08ac-46f9-a482-8f224405f2a7 | ubuntuManila@generic1#GENERIC1 |
  6. +--------------------------------------+---------+------+-------------+-----------+-----------+------------+---------------------------------------------------------------+--------------------------------+

赋予访问权限

  1. 赋予访问权限
  1. $ manila access-allow 2fe736d1-08ac-46f9-a482-8f224405f2a7 ip 192.100.00.168
  2. +--------------+--------------------------------------+
  3. | Property | Value |
  4. +--------------+--------------------------------------+
  5. | share_id | 2fe736d1-08ac-46f9-a482-8f224405f2a7 |
  6. | deleted | False |
  7. | created_at | 2015-08-17T21:36:52.025125 |
  8. | updated_at | None |
  9. | access_type | ip |
  10. | access_to | 192.100.00.168 |
  11. | access_level | rw |
  12. | state | new |
  13. | deleted_at | None |
  14. | id | d73d04ca-a97e-42bb-94b1-e01c72c8e50e |
  15. +--------------+--------------------------------------+
  1. 列出权限列表
  1. $ manila access-list 2fe736d1-08ac-46f9-a482-8f224405f2a7
  2. +--------------------------------------+-------------+----------------+--------------+--------+
  3. | id | access type | access to | access level | state |
  4. +--------------------------------------+-------------+----------------+--------------+--------+
  5. | d73d04ca-a97e-42bb-94b1-e01c72c8e50e | ip | 192.100.00.168 | rw | active |
  6. +--------------------------------------+-------------+----------------+--------------+--------+

收回访问权限

  1. 收回访问权限
  1. $ manila access-deny 2fe736d1-08ac-46f9-a482-8f224405f2a7 d73d04ca-a97e-42bb-94b1-e01c72c8e50e
  1. 列出权限列表
  1. $ manila access-list 2fe736d1-08ac-46f9-a482-8f224405f2a7
  2. +----+-------------+-----------+--------------+-------+
  3. | id | access type | access to | access level | state |
  4. +----+-------------+-----------+--------------+-------+
  5. +----+-------------+-----------+--------------+-------+

创建快照

  1. 创建一份快照
  1. $ manila snapshot-create --name mysnapshot --description "My Manila snapshot" 2fe736d1-08ac-46f9-a482-8f224405f2a7
  2. +-------------+--------------------------------------+
  3. | Property | Value |
  4. +-------------+--------------------------------------+
  5. | status | creating |
  6. | share_id | 2fe736d1-08ac-46f9-a482-8f224405f2a7 |
  7. | name | mysnapshot |
  8. | created_at | 2015-08-17T21:50:53.295017 |
  9. | share_proto | NFS |
  10. | id | 1a411703-baef-495f-8e9c-b60e68f2e657 |
  11. | size | 1 |
  12. | share_size | 1 |
  13. | description | My Manila snapshot |
  14. +-------------+--------------------------------------+
  1. 列出快照列表
  1. $ manila snapshot-list
  2. +--------------------------------------+--------------------------------------+-----------+------------+------------+
  3. | ID | Share ID | Status | Name | Share Size |
  4. +--------------------------------------+--------------------------------------+-----------+------------+------------+
  5. | 1a411703-baef-495f-8e9c-b60e68f2e657 | 2fe736d1-08ac-46f9-a482-8f224405f2a7 | available | mysnapshot | 1 |
  6. +--------------------------------------+--------------------------------------+-----------+------------+------------+

从快照创建共享

  1. 从某份快照创建一个共享
  1. $ manila create --snapshot-id 1a411703-baef-495f-8e9c-b60e68f2e657 --share-network ccd6b453-8b05-4508-bbce-93bfe660451f --name mysharefromsnap NFS 1
  2. +-------------------+--------------------------------------+
  3. | Property | Value |
  4. +-------------------+--------------------------------------+
  5. | status | creating |
  6. | description | None |
  7. | availability_zone | nova |
  8. | share_network_id | ccd6b453-8b05-4508-bbce-93bfe660451f |
  9. | export_locations | [] |
  10. | host | ubuntuManila@generic1#GENERIC1 |
  11. | snapshot_id | 1a411703-baef-495f-8e9c-b60e68f2e657 |
  12. | is_public | False |
  13. | id | bcc5b2a7-862b-418a-9607-5d669619d652 |
  14. | size | 1 |
  15. | name | mysharefromsnap |
  16. | share_type | default |
  17. | created_at | 2015-08-17T21:54:43.000000 |
  18. | export_location | None |
  19. | share_proto | NFS |
  20. | project_id | d80a6323e99f4f22a26ad2accd3ec791 |
  21. | metadata | {} |
  22. +-------------------+--------------------------------------+
  1. 列出共享
  1. $ manila list
  2. +--------------------------------------+-----------------+------+-------------+-----------+-----------+------------+---------------------------------------------------------------+--------------------------------+
  3. | ID | Name | Size | Share Proto | Status | Is Public | Share Type | Export location | Host |
  4. +--------------------------------------+-----------------+------+-------------+-----------+-----------+------------+---------------------------------------------------------------+--------------------------------+
  5. | 2fe736d1-08ac-46f9-a482-8f224405f2a7 | myshare | 1 | NFS | available | False | default | 10.254.0.3:/shares/share-2fe736d1-08ac-46f9-a482-8f224405f2a7 | ubuntuManila@generic1#GENERIC1 |
  6. | bcc5b2a7-862b-418a-9607-5d669619d652 | mysharefromsnap | 1 | NFS | creating | False | default | None | ubuntuManila@generic1#GENERIC1 |
  7. +--------------------------------------+-----------------+------+-------------+-----------+-----------+------------+---------------------------------------------------------------+--------------------------------+
  1. 打印从快照创建出的这份共享的详情
  1. $ manila show bcc5b2a7-862b-418a-9607-5d669619d652
  2. +-------------------+---------------------------------------------------------------+
  3. | Property | Value |
  4. +-------------------+---------------------------------------------------------------+
  5. | status | available |
  6. | description | None |
  7. | availability_zone | nova |
  8. | share_network_id | ccd6b453-8b05-4508-bbce-93bfe660451f |
  9. | export_locations | 10.254.0.3:/shares/share-bcc5b2a7-862b-418a-9607-5d669619d652 |
  10. | host | ubuntuManila@generic1#GENERIC1 |
  11. | snapshot_id | 1a411703-baef-495f-8e9c-b60e68f2e657 |
  12. | is_public | False |
  13. | id | bcc5b2a7-862b-418a-9607-5d669619d652 |
  14. | size | 1 |
  15. | name | mysharefromsnap |
  16. | share_type | default |
  17. | created_at | 2015-08-17T21:54:43.000000 |
  18. | share_proto | NFS |
  19. | project_id | d80a6323e99f4f22a26ad2accd3ec791 |
  20. | metadata | {} |
  21. +-------------------+---------------------------------------------------------------+

删除共享

  1. 删除共享
  1. $ manila delete bcc5b2a7-862b-418a-9607-5d669619d652
  1. 列出共享
  1. $ manila list
  2. +--------------------------------------+-----------------+------+-------------+-----------+-----------+------------+---------------------------------------------------------------+--------------------------------+
  3. | ID | Name | Size | Share Proto | Status | Is Public | Share Type | Export location | Host |
  4. +--------------------------------------+-----------------+------+-------------+-----------+-----------+------------+---------------------------------------------------------------+--------------------------------+
  5. | 2fe736d1-08ac-46f9-a482-8f224405f2a7 | myshare | 1 | NFS | available | False | default | 10.254.0.3:/shares/share-2fe736d1-08ac-46f9-a482-8f224405f2a7 | ubuntuManila@generic1#GENERIC1 |
  6. | bcc5b2a7-862b-418a-9607-5d669619d652 | mysharefromsnap | 1 | NFS | deleting | False | default | 10.254.0.3:/shares/share-bcc5b2a7-862b-418a-9607-5d669619d652 | ubuntuManila@generic1#GENERIC1 |
  7. +--------------------------------------+-----------------+------+-------------+-----------+-----------+------------+---------------------------------------------------------------+--------------------------------+

此时共享已删除。

删除快照

  1. 在删除快照之前,先列出快照
  1. $ manila snapshot-list
  2. +--------------------------------------+--------------------------------------+-----------+------------+------------+
  3. | ID | Share ID | Status | Name | Share Size |
  4. +--------------------------------------+--------------------------------------+-----------+------------+------------+
  5. | 1a411703-baef-495f-8e9c-b60e68f2e657 | 2fe736d1-08ac-46f9-a482-8f224405f2a7 | available | mysnapshot | 1 |
  6. +--------------------------------------+--------------------------------------+-----------+------------+------------+
  1. 删除快照
  1. $ manila snapshot-delete 1a411703-baef-495f-8e9c-b60e68f2e657xyang@ubuntuManila:~/devstack$ manila snapshot-list
  1. 再次列出快照列表
  1. $ manila snapshot-list
  2. +--------------------------------------+--------------------------------------+-----------+------------+------------+
  3. | ID | Share ID | Status | Name | Share Size |
  4. +--------------------------------------+--------------------------------------+-----------+------------+------------+
  5. +--------------------------------------+--------------------------------------+-----------+------------+------------+

此时快照已删除。

为共享盘扩充空间

  1. 扩展共享
  1. $ manila extend 2fe736d1-08ac-46f9-a482-8f224405f2a7 2
  1. 查看正在扩展的共享
  1. $ manila show 2fe736d1-08ac-46f9-a482-8f224405f2a7
  2. +-------------------+---------------------------------------------------------------+
  3. | Property | Value |
  4. +-------------------+---------------------------------------------------------------+
  5. | status | extending |
  6. | description | My Manila share |
  7. | availability_zone | nova |
  8. | share_network_id | ccd6b453-8b05-4508-bbce-93bfe660451f |
  9. | export_locations | 10.254.0.3:/shares/share-2fe736d1-08ac-46f9-a482-8f224405f2a7 |
  10. | host | ubuntuManila@generic1#GENERIC1 |
  11. | snapshot_id | None |
  12. | is_public | False |
  13. | id | 2fe736d1-08ac-46f9-a482-8f224405f2a7 |
  14. | size | 1 |
  15. | name | myshare |
  16. | share_type | default |
  17. | created_at | 2015-08-17T21:17:23.000000 |
  18. | share_proto | NFS |
  19. | project_id | d80a6323e99f4f22a26ad2accd3ec791 |
  20. | metadata | {} |
  21. +-------------------+---------------------------------------------------------------+
  1. 在扩展动作结束后再次查看
  1. $ manila show 2fe736d1-08ac-46f9-a482-8f224405f2a7
  2. +-------------------+---------------------------------------------------------------+
  3. | Property | Value |
  4. +-------------------+---------------------------------------------------------------+
  5. | status | available |
  6. | description | My Manila share |
  7. | availability_zone | nova |
  8. | share_network_id | ccd6b453-8b05-4508-bbce-93bfe660451f |
  9. | export_locations | 10.254.0.3:/shares/share-2fe736d1-08ac-46f9-a482-8f224405f2a7 |
  10. | host | ubuntuManila@generic1#GENERIC1 |
  11. | snapshot_id | None |
  12. | is_public | False |
  13. | id | 2fe736d1-08ac-46f9-a482-8f224405f2a7 |
  14. | size | 2 |
  15. | name | myshare |
  16. | share_type | default |
  17. | created_at | 2015-08-17T21:17:23.000000 |
  18. | share_proto | NFS |
  19. | project_id | d80a6323e99f4f22a26ad2accd3ec791 |
  20. | metadata | {} |
  21. +-------------------+---------------------------------------------------------------+

为共享盘缩减容量

  1. 缩减共享盘容量
  1. $ manila shrink 2fe736d1-08ac-46f9-a482-8f224405f2a7 1
  1. 在缩减的过程中查看共享盘详情
  1. $ manila show 2fe736d1-08ac-46f9-a482-8f224405f2a7
  2. +-------------------+---------------------------------------------------------------+
  3. | Property | Value |
  4. +-------------------+---------------------------------------------------------------+
  5. | status | shrinking |
  6. | description | My Manila share |
  7. | availability_zone | nova |
  8. | share_network_id | ccd6b453-8b05-4508-bbce-93bfe660451f |
  9. | export_locations | 10.254.0.3:/shares/share-2fe736d1-08ac-46f9-a482-8f224405f2a7 |
  10. | host | ubuntuManila@generic1#GENERIC1 |
  11. | snapshot_id | None |
  12. | is_public | False |
  13. | id | 2fe736d1-08ac-46f9-a482-8f224405f2a7 |
  14. | size | 2 |
  15. | name | myshare |
  16. | share_type | default |
  17. | created_at | 2015-08-17T21:17:23.000000 |
  18. | share_proto | NFS |
  19. | project_id | d80a6323e99f4f22a26ad2accd3ec791 |
  20. | metadata | {} |
  21. +-------------------+---------------------------------------------------------------+
  1. 在缩减过程结束后再次查看共享盘详情
  1. $ manila show 2fe736d1-08ac-46f9-a482-8f224405f2a7
  2. +-------------------+---------------------------------------------------------------+
  3. | Property | Value |
  4. +-------------------+---------------------------------------------------------------+
  5. | status | available |
  6. | description | My Manila share |
  7. | availability_zone | nova |
  8. | share_network_id | ccd6b453-8b05-4508-bbce-93bfe660451f |
  9. | export_locations | 10.254.0.3:/shares/share-2fe736d1-08ac-46f9-a482-8f224405f2a7 |
  10. | host | ubuntuManila@generic1#GENERIC1 |
  11. | snapshot_id | None |
  12. | is_public | False |
  13. | id | 2fe736d1-08ac-46f9-a482-8f224405f2a7 |
  14. | size | 1 |
  15. | name | myshare |
  16. | share_type | default |
  17. | created_at | 2015-08-17T21:17:23.000000 |
  18. | share_proto | NFS |
  19. | project_id | d80a6323e99f4f22a26ad2accd3ec791 |
  20. | metadata | {} |
  21. +-------------------+---------------------------------------------------------------+