在能够创建共享之前,启用DHSS模式的普通驱动至少需要一个镜像、一个类型,一个网络和一个共享网络,共享网络用于创建NFS/CIFS服务运行的共享服务器。
在创建使用普通驱动的共享之前,启用DHSS。
获取只有管理能执行命令的管理权限:
$ . admin-openrc
创建启用DHSS的缺省共享类型:
$ manila type-create generic_share_type True
+----------------------+--------------------------------------+
| Property | Value |
+----------------------+--------------------------------------+
| required_extra_specs | driver_handles_share_servers : True |
| Name | generic_share_type |
| Visibility | public |
| is_default | - |
| ID | 3df065c8-6ca4-4b80-a5cb-e633c0439097 |
| optional_extra_specs | snapshot_support : True |
+----------------------+--------------------------------------+
加载 ``demo``证书,作为非管理员项目执行下面的步骤:
$ . demo-openrc
为``selfservice``网络,列出可用网络获取网络和子网ID:
$ neutron net-list
+--------------------------------------+-------------+-----------------------------------------------------+
| id | name | subnets |
+--------------------------------------+-------------+-----------------------------------------------------+
| b72d8561-aceb-4e79-938f-df3a45fdeaa3 | provider | 072dd25f-e049-454c-9b11-359c910e6668 203.0.113.0/24 |
| 4e963f5b-b5f3-4db1-a935-0d34c8629e7b | selfservice | 005bf8d1-798e-450f-9efe-72bc0c3be491 172.16.1.0/24 |
+--------------------------------------+-------------+-----------------------------------------------------+
使用``selfservice``和子网IDs创建共享网络:
$ manila share-network-create --name selfservice-net-share1 \
--neutron-net-id 4e963f5b-b5f3-4db1-a935-0d34c8629e7b \
--neutron-subnet-id 005bf8d1-798e-450f-9efe-72bc0c3be491
+-------------------+--------------------------------------+
| Property | Value |
+-------------------+--------------------------------------+
| name | selfservice-net-share1 |
| segmentation_id | None |
| created_at | 2016-03-31T13:25:39.052439 |
| neutron_subnet_id | 005bf8d1-798e-450f-9efe-72bc0c3be491 |
| updated_at | None |
| network_type | None |
| neutron_net_id | 4e963f5b-b5f3-4db1-a935-0d34c8629e7b |
| ip_version | None |
| nova_net_id | None |
| cidr | None |
| project_id | 3a46a53a377642a284e1d12efabb3b5a |
| id | 997a1a0a-4f4d-4aa3-b7ae-8ae6d9aaa828 |
| description | None |
+-------------------+--------------------------------------+
加载 ``demo``证书,作为非管理员项目执行下面的步骤:
$ . demo-openrc
使用共享网络创建NFS共享:
$ manila create NFS 1 --name share2 \
--share-network selfservice-net-share1 \
--share-type generic_share_type
+-----------------------------+--------------------------------------+
| Property | Value |
+-----------------------------+--------------------------------------+
| status | creating |
| share_type_name | generic_share_type |
| description | None |
| availability_zone | None |
| share_network_id | 997a1a0a-4f4d-4aa3-b7ae-8ae6d9aaa828 |
| host | |
| access_rules_status | active |
| snapshot_id | None |
| is_public | False |
| task_state | None |
| snapshot_support | True |
| id | 6a711b95-9e03-4547-8769-74e34676cb3e |
| size | 1 |
| name | share2 |
| share_type | 8698ed92-2a1c-4c9f-aab4-a35dccd88c8f |
| has_replicas | False |
| replication_type | None |
| created_at | 2016-03-31T13:45:18.000000 |
| share_proto | NFS |
| consistency_group_id | None |
| source_cgsnapshot_member_id | None |
| project_id | 3a46a53a377642a284e1d12efabb3b5a |
| metadata | {} |
+-----------------------------+--------------------------------------+
过会,共享状态将由``创建中`` 变为 可用:
$ manila list
+--------------------------------------+--------+------+-------------+-----------+-----------+--------------------+-----------------------------+-------------------+
| ID | Name | Size | Share Proto | Status | Is Public | Share Type Name | Host | Availability Zone |
+--------------------------------------+--------+------+-------------+-----------+-----------+--------------------+-----------------------------+-------------------+
| 5f8a0574-a95e-40ff-b898-09fd8d6a1fac | share2 | 1 | NFS | available | False | default_share_type | storage@generic#GENERIC | nova |
+--------------------------------------+--------+------+-------------+-----------+-----------+--------------------+-----------------------------+-------------------+
检测导出的共享IP地址:
$ manila show share2
+-----------------------------+------------------------------------------------------------------------------------+
| Property | Value |
+-----------------------------+------------------------------------------------------------------------------------+
| status | available |
| share_type_name | generic_share_type |
| description | None |
| availability_zone | nova |
| share_network_id | None |
| export_locations | |
| | path = 10.254.0.6:/shares/share-0bfd69a1-27f0-4ef5-af17-7cd50bce6550 |
| | id = 3c8d0ada-cadf-48dd-85b8-d4e8c3b1e204 |
| | preferred = False |
| host | storage@generic#GENERIC |
| access_rules_status | active |
| snapshot_id | None |
| is_public | False |
| task_state | None |
| snapshot_support | True |
| id | 5f8a0574-a95e-40ff-b898-09fd8d6a1fac |
| size | 1 |
| name | share2 |
| share_type | 8a35da28-0f74-490d-afff-23664ecd4f01 |
| has_replicas | False |
| replication_type | None |
| created_at | 2016-03-30T19:10:33.000000 |
| share_proto | NFS |
| consistency_group_id | None |
| source_cgsnapshot_member_id | None |
| project_id | 3a46a53a377642a284e1d12efabb3b5a |
| metadata | {} |
+-----------------------------+------------------------------------------------------------------------------------+
在尝试通过网络挂载时,配置用户访问这个新的共享:
$ manila access-allow share2 ip INSTANCE_IP_ADDRESS
+--------------+--------------------------------------+
| Property | Value |
+--------------+--------------------------------------+
| share_id | 55c401b3-3112-4294-aa9f-3cc355a4e361 |
| access_type | ip |
| access_to | 172.16.1.5 |
| access_level | rw |
| state | new |
| id | f88eab01-7197-44bf-ad0f-d6ca6f99fc96 |
+--------------+--------------------------------------+
使用实例IP地址替换``INSTANCE_IP_ADDRESS`` 。
注解
该云主机必须使用``selfservice``网络。
创建一个挂载点目录:
$ mkdir ~/test_folder
在实例中,使用共享导出的目录挂载NFS共享:
# mount -t nfs 10.254.0.6:/shares/share-0bfd69a1-27f0-4ef5-af17-7cd50bce6550 ~/test_folder
想了解更多关于如何管理共享, 请参考OpenStack终端用户手册里的`Manage shares <http://docs.openstack.org/user-guide/cli-manage-shares.html>`__
返回到:ref: launch-instance。
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.