选项1 在没有服务管理的支持下创建共享

选项1 在没有服务管理的支持下创建共享

创建一个共享类型

在使用LVM驱动创建共享之前禁用DHSS。

  1. 获取只有管理能执行命令的管理权限:

    $ . admin-openrc
    
  2. 创建一个禁用DHSS的共享类型:

    $ manila type-create default_share_type False
    +----------------------+--------------------------------------+
    | Property             | Value                                |
    +----------------------+--------------------------------------+
    | required_extra_specs | driver_handles_share_servers : False |
    | Name                 | default_share_type                   |
    | Visibility           | public                               |
    | is_default           | -                                    |
    | ID                   | 3df065c8-6ca4-4b80-a5cb-e633c0439097 |
    | optional_extra_specs | snapshot_support : True              |
    +----------------------+--------------------------------------+
    

创建共享

  1. 加载 ``demo``证书,作为非管理员项目执行下面的步骤:

    $ . demo-openrc
    
  2. 创建NFS共享:

    $ manila create NFS 1 --name share1
    +-----------------------------+--------------------------------------+
    | Property                    | Value                                |
    +-----------------------------+--------------------------------------+
    | status                      | creating                             |
    | share_type_name             | default_share_type                   |
    | description                 | None                                 |
    | availability_zone           | None                                 |
    | share_network_id            | None                                 |
    | host                        |                                      |
    | access_rules_status         | active                               |
    | snapshot_id                 | None                                 |
    | is_public                   | False                                |
    | task_state                  | None                                 |
    | snapshot_support            | True                                 |
    | id                          | 55c401b3-3112-4294-aa9f-3cc355a4e361 |
    | size                        | 1                                    |
    | name                        | share1                               |
    | share_type                  | c6dfcfc6-9920-420e-8b0a-283d578efef5 |
    | 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                    | {}                                   |
    +-----------------------------+--------------------------------------+
    
  3. 过会,共享状态将由``创建中`` 变为 可用

    $ manila list
    +--------------------------------------+--------+------+-------------+-----------+-----------+--------------------+-----------------------------+-------------------+
    | ID                                   | Name   | Size | Share Proto | Status    | Is Public | Share Type Name    | Host                        | Availability Zone |
    +--------------------------------------+--------+------+-------------+-----------+-----------+--------------------+-----------------------------+-------------------+
    | 55c401b3-3112-4294-aa9f-3cc355a4e361 | share1 | 1    | NFS         | available | False     | default_share_type | storage@lvm#lvm-single-pool | nova              |
    +--------------------------------------+--------+------+-------------+-----------+-----------+--------------------+-----------------------------+-------------------+
    
  4. 检测导出的共享IP地址:

    $ manila show share1
    +-----------------------------+------------------------------------------------------------------------------------+
    | Property                    | Value                                                                              |
    +-----------------------------+------------------------------------------------------------------------------------+
    | status                      | available                                                                          |
    | share_type_name             | default_share_type                                                                 |
    | description                 | None                                                                               |
    | availability_zone           | nova                                                                               |
    | share_network_id            | None                                                                               |
    | export_locations            |                                                                                    |
    |                             | path = 10.0.0.41:/var/lib/manila/mnt/share-8e13a98f-c310-41df-ac90-fc8bce4910b8    |
    |                             | id = 3c8d0ada-cadf-48dd-85b8-d4e8c3b1e204                                          |
    |                             | preferred = False                                                                  |
    | host                        | storage@lvm#lvm-single-pool                                                        |
    | access_rules_status         | active                                                                             |
    | snapshot_id                 | None                                                                               |
    | is_public                   | False                                                                              |
    | task_state                  | None                                                                               |
    | snapshot_support            | True                                                                               |
    | id                          | 55c401b3-3112-4294-aa9f-3cc355a4e361                                               |
    | size                        | 1                                                                                  |
    | name                        | share1                                                                             |
    | share_type                  | c6dfcfc6-9920-420e-8b0a-283d578efef5                                               |
    | 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                    | {}                                                                                 |
    +-----------------------------+------------------------------------------------------------------------------------+
    
  5. 在尝试通过网络挂载时,配置用户访问这个新的共享:

    $ manila access-allow share1 ip INSTANCE_IP_ADDRESS
    +--------------+--------------------------------------+
    | Property     | Value                                |
    +--------------+--------------------------------------+
    | share_id     | 55c401b3-3112-4294-aa9f-3cc355a4e361 |
    | access_type  | ip                                   |
    | access_to    | 10.0.0.41                            |
    | access_level | rw                                   |
    | state        | new                                  |
    | id           | f88eab01-7197-44bf-ad0f-d6ca6f99fc96 |
    +--------------+--------------------------------------+
    

    使用实例IP地址替换``INSTANCE_IP_ADDRESS`` 。

    注解

    在存储节点上,实例必须直接连通管理网IP地址。

从实例挂载共享点

  1. 创建一个挂载点目录:

    $ mkdir ~/test_folder
    
  2. 在实例中,使用共享导出的目录挂载NFS共享:

    # mount -t nfs 10.0.0.41:/var/lib/manila/mnt/share-b94a4dbf-49e2-452c-b9c7-510277adf5c6 ~/test_folder
    

想了解更多关于如何管理共享, 请参考OpenStack终端用户手册里的`Manage shares <http://docs.openstack.org/user-guide/cli-manage-shares.html>`__

返回到:ref: launch-instance

Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.