创建和管理共享

通用概念

一个 share 是您可以使用 manila 创建的文件系统存储。您可以选择底层存储的网络协议,并通过 manila 命令行工具管理访问权限并执行共享的生命周期操作。

在回顾可能的操作之前,让我们先了解一些重要术语

  • share network:这是您的共享可以导出到的网络。将共享导出到您自己的自助隔离网络,允许 manila 在多租户云中提供 hard network path 数据隔离保证。为此,在底层,manila 创建隔离的 share servers,并将它们连接到您的网络。这些共享服务器管理共享的导出,并可以连接到您确定的身份验证域。Manila 执行共享服务器所需的所有生命周期操作,您无需担心它们。重要的是要注意,您的云管理员必须为您创建一个具有 extra-spec driver_handles_share_servers=True 的共享类型,才能使用共享网络并创建共享。请参阅 创建和管理共享网络创建和管理共享网络子网 以获取更多详细信息。

  • share type:共享类型是您的管理员提供的模板。除非您想使用默认共享类型,否则在创建共享时必须始终指定共享类型。您的云管理员可能尚未使默认共享类型可供您使用。共享类型指定了一些功能

功能

可能的值

结果

driver_handles_share_servers

真或假

您是否可以使用共享网络创建共享

snapshot_support

真或假

您是否可以创建共享的快照

create_share_from_snapshot_support

真或假

您是否可以创建共享快照的克隆

revert_to_snapshot_support

真或假

您是否可以就地将您的共享恢复到最新的快照

mount_snapshot_support

真或假

您是否可以导出您的快照并挂载它们

replication_type

dr

您可以创建用于灾难恢复的副本,一次只能允许一个活动导出

可读

您可以创建只读副本,一次只能允许一个可写活动导出

可写

您可以创建读/写副本,每个共享可以有任意数量的活动导出

availability_zones

一个或多个可用区的列表

共享仅限于这些可用区

mount_point_name_support

真或假

共享是否可以具有自定义导出位置

encryption_support

share

共享使用共享加密密钥进行加密

share_server

共享使用共享服务器加密密钥进行加密

provisioning:mount_point_prefix

字符串

用于自定义导出位置的前缀

注意

  • 当共享类型中不存在 replication_type extra specification 时,您无法创建共享副本

  • 当共享类型中不存在 availability_zones extra specification 时,该共享类型可以在云的所有可用区中使用。

  • 当共享类型中不存在 mount_point_name_support extra specification 时,或者设置为 False,您无法自定义导出位置。

  • status 资源的状态:您使用 manila 创建或修改的资源可能不会立即“可用”。API 服务旨在立即响应,正在创建或修改的资源由服务堆栈的其余部分处理。为了指示资源的准备情况,资源本身有几个属性,用户可以监视这些字段以了解资源的状态。例如,共享中的 status 属性可以传达一些繁忙状态,例如“创建中”、“扩展中”、“缩小中”、“迁移中”。如果一切顺利,这些“-ing”状态将以“可用”状态结束。如果出现问题,它们可能会以“错误”状态结束。请参阅 排查异步故障 以确定您是否可以自行纠正这些错误。如果无法纠正,咨询更特权的用戶,通常是云管理员,可能会有所帮助。

  • snapshot:这是共享的某个时间点的副本。在 manila 中,快照旨在是崩溃一致的,但是,您可能需要使使用共享的任何应用程序静默,以确保快照是应用程序一致的。云管理员可以通过共享类型 extra specifications 启用或禁用快照。

  • security service:这是您定义的身份验证域,并将其与您的共享网络关联。它可能是 Active Directory 服务器、轻量级目录访问协议服务器或 Kerberos。使用时,可以通过这些身份验证域控制对共享的访问。您甚至可以组合多个身份验证域。

使用和限制

  • 列出适用于您的项目的资源限制和使用情况

    $ manila absolute-limits
    +----------------------------+-------+
    | Name                       | Value |
    +----------------------------+-------+
    | maxTotalReplicaGigabytes   | 1000  |
    | maxTotalShareGigabytes     | 1000  |
    | maxTotalShareNetworks      | 10    |
    | maxTotalShareReplicas      | 100   |
    | maxTotalShareSnapshots     | 50    |
    | maxTotalShares             | 50    |
    | maxTotalSnapshotGigabytes  | 1000  |
    | totalReplicaGigabytesUsed  | 0     |
    | totalShareGigabytesUsed    | 4     |
    | totalShareNetworksUsed     | 1     |
    | totalShareReplicasUsed     | 0     |
    | totalShareSnapshotsUsed    | 1     |
    | totalSharesUsed            | 4     |
    | totalSnapshotGigabytesUsed | 1     |
    +----------------------------+-------+
    

共享类型

  • 列出共享类型

    $ openstack share type list
    +--------------------------------------+-----------------------------------+------------+------------+--------------------------------------+--------------------------------------------+---------------------------------------------------------+
    | ID                                   | Name                              | visibility | is_default | required_extra_specs                 | optional_extra_specs                       | Description                                             |
    +--------------------------------------+-----------------------------------+------------+------------+--------------------------------------+--------------------------------------------+---------------------------------------------------------+
    | af7b64ec-cdb3-4a5f-93c9-51672d72e172 | dhss_true                         | public     | -          | driver_handles_share_servers : True  | snapshot_support : True                    | None                                                    |
    |                                      |                                   |            |            |                                      | create_share_from_snapshot_support : True  |                                                         |
    |                                      |                                   |            |            |                                      | revert_to_snapshot_support : True          |                                                         |
    |                                      |                                   |            |            |                                      | mount_snapshot_support : True              |                                                         |
    | c39d3565-cee0-4a64-9e60-af06991ea4f7 | default                           | public     | YES        | driver_handles_share_servers : False | snapshot_support : True                    | None                                                    |
    |                                      |                                   |            |            |                                      | create_share_from_snapshot_support : True  |                                                         |
    |                                      |                                   |            |            |                                      | revert_to_snapshot_support : True          |                                                         |
    |                                      |                                   |            |            |                                      | mount_snapshot_support : True              |                                                         |
    | e88213ca-66e6-4ae1-ba1b-d9d2c65bae12 | dhss_false                        | public     | -          | driver_handles_share_servers : False | snapshot_support : True                    | None                                                    |
    |                                      |                                   |            |            |                                      | create_share_from_snapshot_support : True  |                                                         |
    |                                      |                                   |            |            |                                      | revert_to_snapshot_support : True          |                                                         |
    |                                      |                                   |            |            |                                      | mount_snapshot_support : True              |                                                         |
    +--------------------------------------+-----------------------------------+------------+------------+--------------------------------------+--------------------------------------------+---------------------------------------------------------+
    

共享网络

  • 创建共享网络。

    $ manila share-network-create \
        --name mysharenetwork \
        --description "My Manila network" \
        --neutron-net-id 23da40b4-0d5e-468c-8ac9-3766e9ceaacd \
        --neutron-subnet-id 4568bc9b-42fe-45ac-a49b-469e8276223c
    +-----------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
    | Property              | Value                                                                                                                                                                                                                                                                                                                                                                             |
    +-----------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
    | id                    | c4bfdd5e-7502-4a65-8876-0ce8b9914a64                                                                                                                                                                                                                                                                                                                                              |
    | name                  | mysharenetwork                                                                                                                                                                                                                                                                                                                                                                    |
    | project_id            | d9932a60d9ee4087b6cff9ce6e9b4e3b                                                                                                                                                                                                                                                                                                                                                  |
    | created_at            | 2020-08-07T04:47:53.000000                                                                                                                                                                                                                                                                                                                                                        |
    | updated_at            | None                                                                                                                                                                                                                                                                                                                                                                              |
    | description           | My Manila network                                                                                                                                                                                                                                                                                                                                                                 |
    | share_network_subnets | [{'id': '187dcd27-8478-45c1-bd5e-5423cafd15ae', 'availability_zone': None, 'created_at': '2020-08-07T04:47:53.000000', 'updated_at': None, 'segmentation_id': None, 'neutron_net_id': '23da40b4-0d5e-468c-8ac9-3766e9ceaacd', 'neutron_subnet_id': '4568bc9b-42fe-45ac-a49b-469e8276223c', 'ip_version': None, 'cidr': None, 'network_type': None, 'mtu': None, 'gateway': None}] |
    +-----------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
    

    注意

    此 Manila API 不会立即验证您提供的子网信息。验证是在使用共享网络创建共享时执行的。这就是为什么,在至少创建了一个共享之后,您才会在共享网络资源上填充一些子网信息。

  • 列出共享网络。

    $ manila share-network-list
    +--------------------------------------+----------------+
    | id                                   | name           |
    +--------------------------------------+----------------+
    | c4bfdd5e-7502-4a65-8876-0ce8b9914a64 | mysharenetwork |
    +--------------------------------------+----------------+
    

创建共享

  • 创建一个共享

    注意

    如果使用具有 extra specification driver_handles_share_servers=False 的共享类型,则无法使用共享网络创建共享。

    $ manila create NFS 1 \
        --name myshare \
        --description "My Manila share" \
        --share-network mysharenetwork \
        --share-type dhss_true
    +---------------------------------------+--------------------------------------+
    | Property                              | Value                                |
    +---------------------------------------+--------------------------------------+
    | id                                    | 83b0772b-00ad-4e45-8fad-106b9d4f1719 |
    | size                                  | 1                                    |
    | availability_zone                     | None                                 |
    | created_at                            | 2020-08-07T05:24:14.000000           |
    | status                                | creating                             |
    | name                                  | myshare                              |
    | description                           | My Manila share                      |
    | project_id                            | d9932a60d9ee4087b6cff9ce6e9b4e3b     |
    | snapshot_id                           | None                                 |
    | share_network_id                      | c4bfdd5e-7502-4a65-8876-0ce8b9914a64 |
    | share_proto                           | NFS                                  |
    | metadata                              | {}                                   |
    | share_type                            | af7b64ec-cdb3-4a5f-93c9-51672d72e172 |
    | is_public                             | False                                |
    | snapshot_support                      | True                                 |
    | task_state                            | None                                 |
    | share_type_name                       | dhss_true                            |
    | access_rules_status                   | active                               |
    | replication_type                      | None                                 |
    | has_replicas                          | False                                |
    | user_id                               | 2cebd96a794f431caa06ce5215e0da21     |
    | create_share_from_snapshot_support    | True                                 |
    | revert_to_snapshot_support            | True                                 |
    | share_group_id                        | None                                 |
    | source_share_group_snapshot_member_id | None                                 |
    | mount_snapshot_support                | True                                 |
    | progress                              | None                                 |
    +---------------------------------------+--------------------------------------+
    
  • 显示共享。

    $ manila show myshare
    +---------------------------------------+----------------------------------------------------------------------------------------------------------------------+
    | Property                              | Value                                                                                                                |
    +---------------------------------------+----------------------------------------------------------------------------------------------------------------------+
    | id                                    | 83b0772b-00ad-4e45-8fad-106b9d4f1719                                                                                 |
    | size                                  | 1                                                                                                                    |
    | availability_zone                     | nova                                                                                                                 |
    | created_at                            | 2020-08-07T05:24:14.000000                                                                                           |
    | status                                | available                                                                                                            |
    | name                                  | myshare                                                                                                              |
    | description                           | My Manila share                                                                                                      |
    | project_id                            | d9932a60d9ee4087b6cff9ce6e9b4e3b                                                                                     |
    | snapshot_id                           | None                                                                                                                 |
    | share_network_id                      | c4bfdd5e-7502-4a65-8876-0ce8b9914a64                                                                                 |
    | share_proto                           | NFS                                                                                                                  |
    | metadata                              | {}                                                                                                                   |
    | share_type                            | af7b64ec-cdb3-4a5f-93c9-51672d72e172                                                                                 |
    | is_public                             | False                                                                                                                |
    | snapshot_support                      | True                                                                                                                 |
    | task_state                            | None                                                                                                                 |
    | share_type_name                       | dhss_true                                                                                                            |
    | access_rules_status                   | active                                                                                                               |
    | replication_type                      | None                                                                                                                 |
    | has_replicas                          | False                                                                                                                |
    | user_id                               | 2cebd96a794f431caa06ce5215e0da21                                                                                     |
    | create_share_from_snapshot_support    | True                                                                                                                 |
    | revert_to_snapshot_support            | True                                                                                                                 |
    | share_group_id                        | None                                                                                                                 |
    | source_share_group_snapshot_member_id | None                                                                                                                 |
    | mount_snapshot_support                | True                                                                                                                 |
    | progress                              | 100%                                                                                                                 |
    | export_locations                      |                                                                                                                      |
    |                                       | id = 908e5a28-c5ea-4627-b17c-1cfeb894ccd1                                                                            |
    |                                       | path = 10.0.0.11:/sharevolumes_10034/share_83b0772b_00ad_4e45_8fad_106b9d4f1719_da404d59_4280_4b32_847f_6cfa4f730bbd |
    |                                       | preferred = True                                                                                                     |
    |                                       | id = 395244a1-8aa9-44af-9fda-f7d6036ce2b9                                                                            |
    |                                       | path = 10.0.0.10:/sharevolumes_10034/share_83b0772b_00ad_4e45_8fad_106b9d4f1719_da404d59_4280_4b32_847f_6cfa4f730bbd |
    |                                       | preferred = False                                                                                                    |
    +---------------------------------------+----------------------------------------------------------------------------------------------------------------------+
    
  • 列出共享。

    $ manila list
    +--------------------------------------+--------------------+------+-------------+-----------+-----------+-----------------+------+-------------------+
    | ID                                   | Name               | Size | Share Proto | Status    | Is Public | Share Type Name | Host | Availability Zone |
    +--------------------------------------+--------------------+------+-------------+-----------+-----------+-----------------+------+-------------------+
    | 83b0772b-00ad-4e45-8fad-106b9d4f1719 | myshare            | 1    | NFS         | available | False     | dhss_true       |      | nova              |
    +--------------------------------------+--------------------+------+-------------+-----------+-----------+-----------------+------+-------------------+
    
  • 列出共享导出位置。

    $ manila share-export-location-list myshare
    +--------------------------------------+---------------------------------------------------------------------------------------------------------------+-----------+
    | ID                                   | Path                                                                                                          | Preferred |
    +--------------------------------------+---------------------------------------------------------------------------------------------------------------+-----------+
    | 395244a1-8aa9-44af-9fda-f7d6036ce2b9 | 10.0.0.10:/sharevolumes_10034/share_83b0772b_00ad_4e45_8fad_106b9d4f1719_da404d59_4280_4b32_847f_6cfa4f730bbd | False     |
    | 908e5a28-c5ea-4627-b17c-1cfeb894ccd1 | 10.0.0.11:/sharevolumes_10034/share_83b0772b_00ad_4e45_8fad_106b9d4f1719_da404d59_4280_4b32_847f_6cfa4f730bbd | True      |
    +--------------------------------------+---------------------------------------------------------------------------------------------------------------+-----------+
    
  • 使用调度器提示创建共享以指定主机。

    使用调度器提示,您可以选择性地指定相对于其他共享的亲和性和反亲和规则。调度器在确定创建共享的位置时将强制执行这些规则。可能的键是 same_hostdifferent_host,值必须是共享名称或 ID。

      $ manila create NFS 1 \
          --name myshare2 \
          --description "My Manila share - Different Host" \
          --share-network mysharenetwork \
          --share-type dhss_true \
          --scheduler-hints different_host=myshare
    
      +---------------------------------------+-----------------------------------------------------------------------+
      | Property                              | Value                                                                 |
      +---------------------------------------+-----------------------------------------------------------------------+
      | id                                    | 40de4f4c-4588-4d9c-844b-f74d8951053a                                  |
      | size                                  | 1                                                                     |
      | availability_zone                     | None                                                                  |
      | created_at                            | 2020-08-07T05:24:14.000000                                            |
      | status                                | creating                                                              |
      | name                                  | myshare2                                                              |
      | description                           | My Manila share - Different Host                                      |
      | project_id                            | d9932a60d9ee4087b6cff9ce6e9b4e3b                                      |
      | snapshot_id                           | None                                                                  |
      | share_network_id                      | c4bfdd5e-7502-4a65-8876-0ce8b9914a64                                  |
      | share_proto                           | NFS                                                                   |
      | metadata                              | {'__affinity_different_host': '83b0772b-00ad-4e45-8fad-106b9d4f1719'} |
      | share_type                            | af7b64ec-cdb3-4a5f-93c9-51672d72e172                                  |
      | is_public                             | False                                                                 |
      | snapshot_support                      | True                                                                  |
      | task_state                            | None                                                                  |
      | share_type_name                       | dhss_true                                                             |
      | access_rules_status                   | active                                                                |
      | replication_type                      | None                                                                  |
      | has_replicas                          | False                                                                 |
      | user_id                               | 2cebd96a794f431caa06ce5215e0da21                                      |
      | create_share_from_snapshot_support    | True                                                                  |
      | revert_to_snapshot_support            | True                                                                  |
      | share_group_id                        | None                                                                  |
      | source_share_group_snapshot_member_id | None                                                                  |
      | mount_snapshot_support                | True                                                                  |
      | progress                              | None                                                                  |
      +---------------------------------------+-----------------------------------------------------------------------+
    
    Share is created in a different host.
    
    .. code-block:: console
    
      $ manila list
      +--------------------------------------+-----------+------+-------------+-----------+-----------+-----------------+-----------------------------+-------------------+
      | ID                                   | Name      | Size | Share Proto | Status    | Is Public | Share Type Name | Host                        | Availability Zone |
      +--------------------------------------+-----------+------+-------------+-----------+-----------+-----------------+-----------------------------+-------------------+
      | 83b0772b-00ad-4e45-8fad-106b9d4f1719 | myshare   | 1    | NFS         | available | False     | default         | nosb-devstack@london#LONDON | nova              |
      | 40de4f4c-4588-4d9c-844b-f74d8951053a | myshare2  | 1    | NFS         | available | False     | default         | nosb-devstack@lisboa#LISBOA | nova              |
      +--------------------------------------+-----------+------+-------------+-----------+-----------+-----------------+-----------------------------+-------------------+
    
  • 使用 mount_point_name 创建共享。

    当您的管理员启用 mount_point_name_support 时,您可以在创建共享期间指定自定义挂载点名称。该名称将与管理员设置的前缀结合使用,以形成共享的导出位置。

    使用 mount_point_name 的通用工作流程

    • 创建 新的 共享:使用 –mount-point-name 标志指定自定义 mount_point_namemount_point_name 的长度不得超过 255 个字符。

     openstack share create NFS 1 --share-type gold_provisioning_prefix \
     --name MyShare --mount-point-name mount_abc1 \
     --share-network 19d78275-55cb-4684-81f2-ec9c07701563
    
    +---------------------------------------+--------------------------------------+
    | Field                                 | Value                                |
    +=======================================+======================================+
    | access_rules_status                   | active                               |
    +---------------------------------------+--------------------------------------+
    | availability_zone                     | None                                 |
    +---------------------------------------+--------------------------------------+
    | create_share_from_snapshot_support    | False                                |
    +---------------------------------------+--------------------------------------+
    | created_at                            | 2024-03-20T20:32:50.819345           |
    +---------------------------------------+--------------------------------------+
    | description                           | None                                 |
    +---------------------------------------+--------------------------------------+
    | has_replicas                          | False                                |
    +---------------------------------------+--------------------------------------+
    | host                                  |                                      |
    +---------------------------------------+--------------------------------------+
    | id                                    | 138a6884-7a9b-4d9a-9ac1-f565701a4b83 |
    +---------------------------------------+--------------------------------------+
    | is_public                             | False                                |
    +---------------------------------------+--------------------------------------+
    | is_soft_deleted                       | False                                |
    +---------------------------------------+--------------------------------------+
    | metadata                              | {}                                   |
    +---------------------------------------+--------------------------------------+
    | mount_snapshot_support                | False                                |
    +---------------------------------------+--------------------------------------+
    | name                                  | MyShare                              |
    +---------------------------------------+--------------------------------------+
    | progress                              | None                                 |
    +---------------------------------------+--------------------------------------+
    | project_id                            | 44754d5c4aea4c8c8d619bb6b4ebeb17     |
    +---------------------------------------+--------------------------------------+
    | replication_type                      | None                                 |
    +---------------------------------------+--------------------------------------+
    | revert_to_snapshot_support            | False                                |
    +---------------------------------------+--------------------------------------+
    | scheduled_to_be_deleted_at            | None                                 |
    +---------------------------------------+--------------------------------------+
    | share_group_id                        | None                                 |
    +---------------------------------------+--------------------------------------+
    | share_network_id                      | 19d78275-55cb-4684-81f2-ec9c07701563 |
    +---------------------------------------+--------------------------------------+
    | share_proto                           | NFS                                  |
    +---------------------------------------+--------------------------------------+
    | share_server_id                       | None                                 |
    +---------------------------------------+--------------------------------------+
    | share_type                            | ee1995d8-6827-4711-a58d-38ee00f24a75 |
    +---------------------------------------+--------------------------------------+
    | share_type_name                       | gold_provisioning_prefix             |
    +---------------------------------------+--------------------------------------+
    | size                                  | 1                                    |
    +---------------------------------------+--------------------------------------+
    | snapshot_id                           | None                                 |
    +---------------------------------------+--------------------------------------+
    | snapshot_support                      | False                                |
    +---------------------------------------+--------------------------------------+
    | source_backup_id                      | None                                 |
    +---------------------------------------+--------------------------------------+
    | source_share_group_snapshot_member_id | None                                 |
    +---------------------------------------+--------------------------------------+
    | status                                | creating                             |
    +---------------------------------------+--------------------------------------+
    | task_state                            | None                                 |
    +---------------------------------------+--------------------------------------+
    | user_id                               | fbdba3d017b2484f9773033e3fc0c6ae     |
    +---------------------------------------+--------------------------------------+
    | volume_type                           | gold_provisioning_prefix             |
    +---------------------------------------+--------------------------------------+
    
  • 要查看使用自定义 mount_point_name 创建的共享的详细信息。

     $ openstack share show 138a6884-7a9b-4d9a-9ac1-f565701a4b83
    
    +---------------------------------------+-------------------------------------------------------------------------+
    | Field                                 | Value                                                                   |
    +---------------------------------------+-------------------------------------------------------------------------+
    | access_rules_status                   | active                                                                  |
    | availability_zone                     | nova                                                                    |
    | create_share_from_snapshot_support    | False                                                                   |
    | created_at                            | 2024-03-20T20:32:50.819345                                              |
    | description                           | None                                                                    |
    | export_locations                      |                                                                         |
    |                                       | id = 1f5d8a51-965e-4062-a1e1-03ca146ad277                               |
    |                                       | path = <ip>:/gold_mount_abc1                                            |
    |                                       | preferred = True                                                        |
    |                                       | share_instance_id = 62a4d622-a3c8-4915-adca-54a7fe5789bf                |
    |                                       | is_admin_only = False                                                   |
    |                                       | id = ea7c936a-d94b-47bd-8a35-4b2f1f7b5e5a                               |
    |                                       | path = <ip>:/gold_mount_abc1                                            |
    |                                       | preferred = False                                                       |
    |                                       | share_instance_id = 62a4d622-a3c8-4915-adca-54a7fe5789bf                |
    |                                       | is_admin_only = False                                                   |
    | has_replicas                          | False                                                                   |
    | host                                  | host@share_server_dhss_true#AstraInfra                                  |
    | id                                    | 138a6884-7a9b-4d9a-9ac1-f565701a4b83                                    |
    | is_public                             | False                                                                   |
    | is_soft_deleted                       | False                                                                   |
    | mount_snapshot_support                | False                                                                   |
    | name                                  | MyShare                                                                 |
    | progress                              | 100%                                                                    |
    | project_id                            | 44754d5c4aea4c8c8d619bb6b4ebeb17                                        |
    | properties                            |                                                                         |
    | replication_type                      | None                                                                    |
    | revert_to_snapshot_support            | False                                                                   |
    | scheduled_to_be_deleted_at            | None                                                                    |
    | share_group_id                        | None                                                                    |
    | share_network_id                      | 19d78275-55cb-4684-81f2-ec9c07701563                                    |
    | share_proto                           | NFS                                                                     |
    +---------------------------------------+-------------------------------------------------------------------------+
    
  • 使用加密密钥引用创建共享。

    用户可以使用他们自己的加密密钥创建共享。密钥必须存储在密钥管理器(Openstack Barbican)服务中。首先创建共享类型并指定 extra-spec encryption_support。它可以具有值 shareshare_server,具体取决于后端存储驱动程序的支持。然后使用 share create 命令中的 –encryption-key-ref 选项。用户可以使用加密密钥引用或密钥引用的 UUID。

    $ openstack share create NFS 1 \
        --name myshare3 \
        --description "My Manila share - Encrypted" \
        --share-network mysharenetwork \
        --share-type encrypted_share_type \
        --encryption-key-ref 86babe9b-7277-4c3a-a081-6eb3eac9231d
    
    +---------------------------------------+-----------------------------------------------------------------------+
    | Property                              | Value                                                                 |
    +---------------------------------------+-----------------------------------------------------------------------+
    | id                                    | 40de4f4c-4588-4d9c-844b-f74d8951053a                                  |
    | size                                  | 1                                                                     |
    | availability_zone                     | None                                                                  |
    | created_at                            | 2020-08-07T05:24:14.000000                                            |
    | status                                | creating                                                              |
    | name                                  | myshare3                                                              |
    | description                           | My Manila share - Encrypted                                           |
    | project_id                            | d9932a60d9ee4087b6cff9ce6e9b4e3b                                      |
    | snapshot_id                           | None                                                                  |
    | share_network_id                      | c4bfdd5e-7502-4a65-8876-0ce8b9914a64                                  |
    | share_proto                           | NFS                                                                   |
    | metadata                              | {}                                                                    |
    | share_type                            | af7b64ec-cdb3-4a5f-93c9-51672d72e172                                  |
    | is_public                             | False                                                                 |
    | snapshot_support                      | True                                                                  |
    | task_state                            | None                                                                  |
    | share_type_name                       | encrypted_share_type                                                  |
    | access_rules_status                   | active                                                                |
    | replication_type                      | None                                                                  |
    | has_replicas                          | False                                                                 |
    | user_id                               | 2cebd96a794f431caa06ce5215e0da21                                      |
    | create_share_from_snapshot_support    | True                                                                  |
    | revert_to_snapshot_support            | True                                                                  |
    | share_group_id                        | None                                                                  |
    | encryption_key_ref                    | 86babe9b-7277-4c3a-a081-6eb3eac9231d                                  |
    | source_share_group_snapshot_member_id | None                                                                  |
    | mount_snapshot_support                | True                                                                  |
    | progress                              | None                                                                  |
    +---------------------------------------+-----------------------------------------------------------------------+
    

授予和撤销共享访问权限

提示

从 2023.2 (Bobcat) 版本开始,如果您想限制敏感字段(access_toaccess_key)的可见性,或者避免其他用户删除访问规则,您可以指定 Manila OpenStack 命令中创建访问规则的 --lock-visibility--lock-deletion。还可以提供原因(--lock-reason)。只有放置锁定的用户、系统管理员和服务才能操作这些访问规则。如果锁定访问规则的删除,Manila 还会对共享放置额外的锁定,以确保不会删除它并导致断开连接。

允许读写访问

  • 允许访问。

    $ manila access-allow myshare ip 10.0.0.0/24 --metadata key1=value1
    +--------------+--------------------------------------+
    | Property     | Value                                |
    +--------------+--------------------------------------+
    | id           | e30bde96-9217-4f90-afdc-27c092af1c77 |
    | share_id     | 83b0772b-00ad-4e45-8fad-106b9d4f1719 |
    | access_level | rw                                   |
    | access_to    | 10.0.0.0/24                          |
    | access_type  | ip                                   |
    | state        | queued_to_apply                      |
    | access_key   | None                                 |
    | created_at   | 2020-08-07T05:27:27.000000           |
    | updated_at   | None                                 |
    | metadata     | {'key1': 'value1'}                   |
    +--------------+--------------------------------------+
    

    注意

    从 API 版本 2.38 开始,IP 类型的访问规则支持 IPv6 地址和 CIDR 表示法中的子网。

    注意

    从 API 版本 2.45 开始,可以以键值对的形式添加、删除和更新共享访问规则的元数据。元数据可以帮助您识别和过滤访问规则。

  • 列出访问权限。

    $ manila access-list myshare
    +--------------------------------------+-------------+-------------+--------------+--------+------------+----------------------------+------------+
    | id                                   | access_type | access_to   | access_level | state  | access_key | created_at                 | updated_at |
    +--------------------------------------+-------------+-------------+--------------+--------+------------+----------------------------+------------+
    | e30bde96-9217-4f90-afdc-27c092af1c77 | ip          | 10.0.0.0/24 | rw           | active | None       | 2020-08-07T05:27:27.000000 | None       |
    +--------------------------------------+-------------+-------------+--------------+--------+------------+----------------------------+------------+
    

    创建了一个访问规则。

允许只读访问

  • 允许访问。

    $ manila access-allow myshare ip fd31:7ee0:3de4:a41b::/64 --access-level ro
    +--------------+--------------------------------------+
    | Property     | Value                                |
    +--------------+--------------------------------------+
    | id           | 45b0a030-306a-4305-9e2a-36aeffb2d5b7 |
    | share_id     | 83b0772b-00ad-4e45-8fad-106b9d4f1719 |
    | access_level | ro                                   |
    | access_to    | fd31:7ee0:3de4:a41b::/64             |
    | access_type  | ip                                   |
    | state        | queued_to_apply                      |
    | access_key   | None                                 |
    | created_at   | 2020-08-07T05:28:35.000000           |
    | updated_at   | None                                 |
    | metadata     | {}                                   |
    +--------------+--------------------------------------+
    
  • 列出访问权限。

    $ manila access-list myshare
    +--------------------------------------+-------------+----------------------------+--------------+--------+------------+----------------------------+------------+
    | id                                   | access_type | access_to                  | access_level | state  | access_key | created_at                 | updated_at |
    +--------------------------------------+-------------+----------------------------+--------------+--------+------------+----------------------------+------------+
    | 45b0a030-306a-4305-9e2a-36aeffb2d5b7 | ip          | fd31:7ee0:3de4:a41b::/64   | ro           | active | None       | 2020-08-07T05:28:35.000000 | None       |
    | e30bde96-9217-4f90-afdc-27c092af1c77 | ip          | 10.0.0.0/24                | rw           | active | None       | 2020-08-07T05:27:27.000000 | None       |
    +--------------------------------------+-------------+----------------------------+--------------+--------+------------+----------------------------+------------+
    

    创建另一个访问规则。

注意

如果一个或多个访问规则的可见性被锁定,您可能无法看到包含敏感信息(access_toaccess_key)的字段的内容。

更新访问规则元数据

  1. 添加新的元数据。

    $ manila access-metadata 0c8470ca-0d77-490c-9e71-29e1f453bf97 set key2=value2
    $ manila access-show 0c8470ca-0d77-490c-9e71-29e1f453bf97
    +--------------+--------------------------------------+
    | Property     | Value                                |
    +--------------+--------------------------------------+
    | id           | 0c8470ca-0d77-490c-9e71-29e1f453bf97 |
    | share_id     | 8d8b854b-ec32-43f1-acc0-1b2efa7c3400 |
    | access_level | rw                                   |
    | access_to    | 10.0.0.0/24                          |
    | access_type  | ip                                   |
    | state        | active                               |
    | access_key   | None                                 |
    | created_at   | 2016-03-24T14:51:36.000000           |
    | updated_at   | None                                 |
    | metadata     | {'key1': 'value1', 'key2': 'value2'} |
    +--------------+--------------------------------------+
    
  2. 删除元数据键值。

    $ manila access-metadata 0c8470ca-0d77-490c-9e71-29e1f453bf97 unset key
    $ manila access-show 0c8470ca-0d77-490c-9e71-29e1f453bf97
    +--------------+--------------------------------------+
    | Property     | Value                                |
    +--------------+--------------------------------------+
    | id           | 0c8470ca-0d77-490c-9e71-29e1f453bf97 |
    | share_id     | 8d8b854b-ec32-43f1-acc0-1b2efa7c3400 |
    | access_level | rw                                   |
    | access_to    | 10.0.0.0/24                          |
    | access_type  | ip                                   |
    | state        | active                               |
    | access_key   | None                                 |
    | created_at   | 2016-03-24T14:51:36.000000           |
    | updated_at   | None                                 |
    | metadata     | {'key2': 'value2'}                   |
    +--------------+--------------------------------------+
    

拒绝访问

  • 拒绝访问。

    $ manila access-deny myshare 45b0a030-306a-4305-9e2a-36aeffb2d5b7
    $ manila access-deny myshare e30bde96-9217-4f90-afdc-27c092af1c77
    

注意

从 2023.2 (Bobcat) 版本开始,可以防止删除访问规则。如果您在创建访问规则期间放置了删除锁定,则必须在请求中从 Manila 的 OpenStack Client 使用 --unrestrict 参数来撤销访问权限。

  • 列出访问权限。

    $ manila access-list myshare
    +----+-------------+-----------+--------------+-------+------------+------------+------------+
    | id | access_type | access_to | access_level | state | access_key | created_at | updated_at |
    +----+-------------+-----------+--------------+-------+------------+------------+------------+
    +----+-------------+-----------+--------------+-------+------------+------------+------------+
    

    删除访问规则。

创建快照

  • 创建快照。

    注意

    要创建快照,共享的共享类型必须包含 capability extra-spec snapshot_support=True

     $ openstack share snapshot create --name mysnap --description "My Manila snapshot" myshare
    +-------------------+--------------------------------------+
    | Field             | Value                                |
    +-------------------+--------------------------------------+
    | id                | 286edbe1-a69e-40e7-ad50-61287570df55 |
    | share_id          | bf7ffbb7-73a5-44fe-a93e-73cbd5a9197d |
    | share_size        | 1                                    |
    | created_at        | 2025-03-08T00:06:32.123637           |
    | status            | creating                             |
    | name              | mysnap                               |
    | description       | My Manila snapshot                   |
    | size              | 1                                    |
    | share_proto       | NFS                                  |
    | provider_location | None                                 |
    | user_id           | 64e1409650ee4e94a8e78df24da86091     |
    | project_id        | dd43995fee324b24b79adab2542d74e9     |
    | metadata          | {}                                   |
    +-------------------+--------------------------------------+
    
  • 列出快照。

     $ openstack share snapshot list
    +--------------------------------------+--------+
    | ID                                   | Name   |
    +--------------------------------------+--------+
    | 7861eed0-8634-41e0-a57e-a1d87ad48a1b | mysnap |
    +--------------------------------------+--------+
    

挂载快照

  • 允许访问快照。

    注意

    要挂载快照,父共享的共享类型必须包含 capability extra-spec mount_snapshot_support=True

     $ openstack share snapshot access create mysnap ip 192.168.1.0/24
    +-------------+--------------------------------------+
    | Field       | Value                                |
    +-------------+--------------------------------------+
    | id          | 89e36a97-19d8-430c-b920-6d930ea27464 |
    | access_type | ip                                   |
    | access_to   | 192.168.1.0/24                       |
    | state       | queued_to_apply                      |
    +-------------+--------------------------------------+
    
  • 列出快照访问权限。

     $ openstack share snapshot access list mysnap
    +--------------------------------------+-------------+----------------+--------+
    | ID                                   | Access Type | Access To      | State  |
    +--------------------------------------+-------------+----------------+--------+
    | 89e36a97-19d8-430c-b920-6d930ea27464 | ip          | 192.168.1.0/24 | active |
    +--------------------------------------+-------------+----------------+--------+
    

然后继续在访问权限被创建的客户端上挂载快照。

  • 删除快照访问规则。

    $ openstack share snapshot access delete mysnap 89e36a97-19d8-430c-b920-6d930ea27464
    

从快照创建共享

  • 从快照创建共享。

    注意

    要从快照创建共享,父共享的共享类型必须包含 capability extra-spec create_share_from_snapshot_support=True

    $ manila create NFS 1 \
        --snapshot-id 8a18aa77-7500-4e56-be8f-6081146f47f1 \
        --share-network mysharenetwork \
        --name mysharefromsnap
    +---------------------------------------+--------------------------------------+
    | Property                              | Value                                |
    +---------------------------------------+--------------------------------------+
    | id                                    | 2a9336ea-3afc-4443-80bb-398f4bdb3a93 |
    | size                                  | 1                                    |
    | availability_zone                     | nova                                 |
    | created_at                            | 2020-08-07T05:34:12.000000           |
    | status                                | creating                             |
    | name                                  | mysharefromsnap                      |
    | description                           | None                                 |
    | project_id                            | d9932a60d9ee4087b6cff9ce6e9b4e3b     |
    | snapshot_id                           | 8a18aa77-7500-4e56-be8f-6081146f47f1 |
    | share_network_id                      | c4bfdd5e-7502-4a65-8876-0ce8b9914a64 |
    | share_proto                           | NFS                                  |
    | metadata                              | {}                                   |
    | share_type                            | af7b64ec-cdb3-4a5f-93c9-51672d72e172 |
    | is_public                             | False                                |
    | snapshot_support                      | True                                 |
    | task_state                            | None                                 |
    | share_type_name                       | dhss_true                            |
    | access_rules_status                   | active                               |
    | replication_type                      | None                                 |
    | has_replicas                          | False                                |
    | user_id                               | 2cebd96a794f431caa06ce5215e0da21     |
    | create_share_from_snapshot_support    | True                                 |
    | revert_to_snapshot_support            | True                                 |
    | share_group_id                        | None                                 |
    | source_share_group_snapshot_member_id | None                                 |
    | mount_snapshot_support                | True                                 |
    | progress                              | None                                 |
    +---------------------------------------+--------------------------------------+
    
  • 列出共享。

     $ openstack share list
    +--------------------------------------+---------+------+-------------+-----------+-----------+-----------------+-------------------------------------------+-------------------+
    | ID                                   | Name    | Size | Share Proto | Status    | Is Public | Share Type Name | Host                                      | Availability Zone |
    +--------------------------------------+---------+------+-------------+-----------+-----------+-----------------+-------------------------------------------+-------------------+
    | bf7ffbb7-73a5-44fe-a93e-73cbd5a9197d | myshare |    1 | NFS         | available | False     | default         | oid-na-scale-1@bogota#fake_pool_for_DELTA | manila-zone-3     |
    +--------------------------------------+---------+------+-------------+-----------+-----------+-----------------+-------------------------------------------+-------------------+
    
  • 显示从快照创建的共享。

    $ manila show mysharefromsnap
    +---------------------------------------+----------------------------------------------------------------------------------------------------------------------+
    | Property                              | Value                                                                                                                |
    +---------------------------------------+----------------------------------------------------------------------------------------------------------------------+
    | id                                    | 2a9336ea-3afc-4443-80bb-398f4bdb3a93                                                                                 |
    | size                                  | 1                                                                                                                    |
    | availability_zone                     | nova                                                                                                                 |
    | created_at                            | 2020-08-07T05:34:12.000000                                                                                           |
    | status                                | available                                                                                                            |
    | name                                  | mysharefromsnap                                                                                                      |
    | description                           | None                                                                                                                 |
    | project_id                            | d9932a60d9ee4087b6cff9ce6e9b4e3b                                                                                     |
    | snapshot_id                           | 8a18aa77-7500-4e56-be8f-6081146f47f1                                                                                 |
    | share_network_id                      | c4bfdd5e-7502-4a65-8876-0ce8b9914a64                                                                                 |
    | share_proto                           | NFS                                                                                                                  |
    | metadata                              | {}                                                                                                                   |
    | share_type                            | af7b64ec-cdb3-4a5f-93c9-51672d72e172                                                                                 |
    | is_public                             | False                                                                                                                |
    | snapshot_support                      | True                                                                                                                 |
    | task_state                            | None                                                                                                                 |
    | share_type_name                       | dhss_true                                                                                                            |
    | access_rules_status                   | active                                                                                                               |
    | replication_type                      | None                                                                                                                 |
    | has_replicas                          | False                                                                                                                |
    | user_id                               | 2cebd96a794f431caa06ce5215e0da21                                                                                     |
    | create_share_from_snapshot_support    | True                                                                                                                 |
    | revert_to_snapshot_support            | True                                                                                                                 |
    | share_group_id                        | None                                                                                                                 |
    | source_share_group_snapshot_member_id | None                                                                                                                 |
    | mount_snapshot_support                | True                                                                                                                 |
    | progress                              | 100%                                                                                                                 |
    | export_locations                      |                                                                                                                      |
    |                                       | id = 7928b361-cada-4505-a62e-4cefb1cf6fc5                                                                            |
    |                                       | path = 10.0.0.11:/path/to/fake/share/share_2a9336ea_3afc_4443_80bb_398f4bdb3a93_97de2abe_d114_49a9_9d01_ce5e71337e48 |
    |                                       | preferred = True                                                                                                     |
    |                                       | id = e48d19ba-dee5-4492-b156-5181530955be                                                                            |
    |                                       | path = 10.0.0.10:/path/to/fake/share/share_2a9336ea_3afc_4443_80bb_398f4bdb3a93_97de2abe_d114_49a9_9d01_ce5e71337e48 |
    |                                       | preferred = False                                                                                                    |
    +---------------------------------------+----------------------------------------------------------------------------------------------------------------------+
    

删除共享

  • 删除共享。

    $ manila delete mysharefromsnap
    
  • 列出共享。

    $ manila list
    +--------------------------------------+-----------------+------+-------------+-----------+-----------+-----------------+-----------------------------+-------------------+
    | ID                                   | Name            | Size | Share Proto | Status    | Is Public | Share Type Name | Host                        | Availability Zone |
    +--------------------------------------+-----------------+------+-------------+-----------+-----------+-----------------+-----------------------------+-------------------+
    | 83b0772b-00ad-4e45-8fad-106b9d4f1719 | myshare         | 1    | NFS         | available | False     | default         | nosb-devstack@london#LONDON | nova              |
    | 2a9336ea-3afc-4443-80bb-398f4bdb3a93 | mysharefromsnap | 1    | NFS         | deleting  | False     | default         | nosb-devstack@london#LONDON | nova              |
    +--------------------------------------+-----------------+------+-------------+-----------+-----------+-----------------+-----------------------------+-------------------+
    

    正在删除共享。

删除快照

  • 删除快照。

    $ manila snapshot-delete mysnapshot
    
  • 删除后列出快照。

    $ manila snapshot-list
    
    +----+----------+--------+------+------------+
    | ID | Share ID | Status | Name | Share Size |
    +----+----------+--------+------+------------+
    +----+----------+--------+------+------------+
    

    快照已删除。

扩展共享

  • 扩展共享。

    $ manila extend myshare 2
    
  • 显示共享在扩展期间的状态。

    $ manila show myshare
    +---------------------------------------+----------------------------------------------------------------------------------------------------------------------+
    | Property                              | Value                                                                                                                |
    +---------------------------------------+----------------------------------------------------------------------------------------------------------------------+
    | id                                    | 83b0772b-00ad-4e45-8fad-106b9d4f1719                                                                                 |
    | size                                  | 1                                                                                                                    |
    | availability_zone                     | nova                                                                                                                 |
    | created_at                            | 2020-08-07T05:24:14.000000                                                                                           |
    | status                                | extending                                                                                                            |
    | name                                  | myshare                                                                                                              |
    | description                           | My Manila share                                                                                                      |
    | project_id                            | d9932a60d9ee4087b6cff9ce6e9b4e3b                                                                                     |
    | snapshot_id                           | None                                                                                                                 |
    | share_network_id                      | c4bfdd5e-7502-4a65-8876-0ce8b9914a64                                                                                 |
    | share_proto                           | NFS                                                                                                                  |
    | metadata                              | {}                                                                                                                   |
    | share_type                            | af7b64ec-cdb3-4a5f-93c9-51672d72e172                                                                                 |
    | is_public                             | False                                                                                                                |
    | snapshot_support                      | True                                                                                                                 |
    | task_state                            | None                                                                                                                 |
    | share_type_name                       | dhss_true                                                                                                            |
    | access_rules_status                   | active                                                                                                               |
    | replication_type                      | None                                                                                                                 |
    | has_replicas                          | False                                                                                                                |
    | user_id                               | 2cebd96a794f431caa06ce5215e0da21                                                                                     |
    | create_share_from_snapshot_support    | True                                                                                                                 |
    | revert_to_snapshot_support            | True                                                                                                                 |
    | share_group_id                        | None                                                                                                                 |
    | source_share_group_snapshot_member_id | None                                                                                                                 |
    | mount_snapshot_support                | True                                                                                                                 |
    | progress                              | 100%                                                                                                                 |
    | export_locations                      |                                                                                                                      |
    |                                       | id = 908e5a28-c5ea-4627-b17c-1cfeb894ccd1                                                                            |
    |                                       | path = 10.0.0.11:/path/to/fake/share/share_83b0772b_00ad_4e45_8fad_106b9d4f1719_da404d59_4280_4b32_847f_6cfa4f730bbd |
    |                                       | preferred = True                                                                                                     |
    |                                       | id = 395244a1-8aa9-44af-9fda-f7d6036ce2b9                                                                            |
    |                                       | path = 10.0.0.10:/path/to/fake/share/share_83b0772b_00ad_4e45_8fad_106b9d4f1719_da404d59_4280_4b32_847f_6cfa4f730bbd |
    |                                       | preferred = False                                                                                                    |
    +---------------------------------------+----------------------------------------------------------------------------------------------------------------------+
    
  • 显示扩展后的共享。

    $ manila show myshare
    +---------------------------------------+----------------------------------------------------------------------------------------------------------------------+
    | Property                              | Value                                                                                                                |
    +---------------------------------------+----------------------------------------------------------------------------------------------------------------------+
    | id                                    | 83b0772b-00ad-4e45-8fad-106b9d4f1719                                                                                 |
    | size                                  | 2                                                                                                                    |
    | availability_zone                     | nova                                                                                                                 |
    | created_at                            | 2020-08-07T05:24:14.000000                                                                                           |
    | status                                | available                                                                                                            |
    | name                                  | myshare                                                                                                              |
    | description                           | My Manila share                                                                                                      |
    | project_id                            | d9932a60d9ee4087b6cff9ce6e9b4e3b                                                                                     |
    | snapshot_id                           | None                                                                                                                 |
    | share_network_id                      | c4bfdd5e-7502-4a65-8876-0ce8b9914a64                                                                                 |
    | share_proto                           | NFS                                                                                                                  |
    | metadata                              | {}                                                                                                                   |
    | share_type                            | af7b64ec-cdb3-4a5f-93c9-51672d72e172                                                                                 |
    | is_public                             | False                                                                                                                |
    | snapshot_support                      | True                                                                                                                 |
    | task_state                            | None                                                                                                                 |
    | share_type_name                       | dhss_true                                                                                                            |
    | access_rules_status                   | active                                                                                                               |
    | replication_type                      | None                                                                                                                 |
    | has_replicas                          | False                                                                                                                |
    | user_id                               | 2cebd96a794f431caa06ce5215e0da21                                                                                     |
    | create_share_from_snapshot_support    | True                                                                                                                 |
    | revert_to_snapshot_support            | True                                                                                                                 |
    | share_group_id                        | None                                                                                                                 |
    | source_share_group_snapshot_member_id | None                                                                                                                 |
    | mount_snapshot_support                | True                                                                                                                 |
    | progress                              | 100%                                                                                                                 |
    | export_locations                      |                                                                                                                      |
    |                                       | id = 908e5a28-c5ea-4627-b17c-1cfeb894ccd1                                                                            |
    |                                       | path = 10.0.0.11:/path/to/fake/share/share_83b0772b_00ad_4e45_8fad_106b9d4f1719_da404d59_4280_4b32_847f_6cfa4f730bbd |
    |                                       | preferred = True                                                                                                     |
    |                                       | id = 395244a1-8aa9-44af-9fda-f7d6036ce2b9                                                                            |
    |                                       | path = 10.0.0.10:/path/to/fake/share/share_83b0772b_00ad_4e45_8fad_106b9d4f1719_da404d59_4280_4b32_847f_6cfa4f730bbd |
    |                                       | preferred = False                                                                                                    |
    +---------------------------------------+----------------------------------------------------------------------------------------------------------------------+
    

缩小共享

  • 缩小共享。

    $ manila shrink myshare 1
    
  • 显示共享在缩小期间的状态。

    $ manila show myshare
    +---------------------------------------+----------------------------------------------------------------------------------------------------------------------+
    | Property                              | Value                                                                                                                |
    +---------------------------------------+----------------------------------------------------------------------------------------------------------------------+
    | id                                    | 83b0772b-00ad-4e45-8fad-106b9d4f1719                                                                                 |
    | size                                  | 2                                                                                                                    |
    | availability_zone                     | nova                                                                                                                 |
    | created_at                            | 2020-08-07T05:24:14.000000                                                                                           |
    | status                                | shrinking                                                                                                            |
    | name                                  | myshare                                                                                                              |
    | description                           | My Manila share                                                                                                      |
    | project_id                            | d9932a60d9ee4087b6cff9ce6e9b4e3b                                                                                     |
    | snapshot_id                           | None                                                                                                                 |
    | share_network_id                      | c4bfdd5e-7502-4a65-8876-0ce8b9914a64                                                                                 |
    | share_proto                           | NFS                                                                                                                  |
    | metadata                              | {}                                                                                                                   |
    | share_type                            | af7b64ec-cdb3-4a5f-93c9-51672d72e172                                                                                 |
    | is_public                             | False                                                                                                                |
    | snapshot_support                      | True                                                                                                                 |
    | task_state                            | None                                                                                                                 |
    | share_type_name                       | dhss_true                                                                                                            |
    | access_rules_status                   | active                                                                                                               |
    | replication_type                      | None                                                                                                                 |
    | has_replicas                          | False                                                                                                                |
    | user_id                               | 2cebd96a794f431caa06ce5215e0da21                                                                                     |
    | create_share_from_snapshot_support    | True                                                                                                                 |
    | revert_to_snapshot_support            | True                                                                                                                 |
    | share_group_id                        | None                                                                                                                 |
    | source_share_group_snapshot_member_id | None                                                                                                                 |
    | mount_snapshot_support                | True                                                                                                                 |
    | progress                              | 100%                                                                                                                 |
    | export_locations                      |                                                                                                                      |
    |                                       | id = 908e5a28-c5ea-4627-b17c-1cfeb894ccd1                                                                            |
    |                                       | path = 10.0.0.11:/path/to/fake/share/share_83b0772b_00ad_4e45_8fad_106b9d4f1719_da404d59_4280_4b32_847f_6cfa4f730bbd |
    |                                       | preferred = True                                                                                                     |
    |                                       | id = 395244a1-8aa9-44af-9fda-f7d6036ce2b9                                                                            |
    |                                       | path = 10.0.0.10:/path/to/fake/share/share_83b0772b_00ad_4e45_8fad_106b9d4f1719_da404d59_4280_4b32_847f_6cfa4f730bbd |
    |                                       | preferred = False                                                                                                    |
    +---------------------------------------+----------------------------------------------------------------------------------------------------------------------+
    
  • 显示缩小后的共享。

    $ manila show myshare
    +---------------------------------------+----------------------------------------------------------------------------------------------------------------------+
    | Property                              | Value                                                                                                                |
    +---------------------------------------+----------------------------------------------------------------------------------------------------------------------+
    | id                                    | 83b0772b-00ad-4e45-8fad-106b9d4f1719                                                                                 |
    | size                                  | 1                                                                                                                    |
    | availability_zone                     | nova                                                                                                                 |
    | created_at                            | 2020-08-07T05:24:14.000000                                                                                           |
    | status                                | available                                                                                                            |
    | name                                  | myshare                                                                                                              |
    | description                           | My Manila share                                                                                                      |
    | project_id                            | d9932a60d9ee4087b6cff9ce6e9b4e3b                                                                                     |
    | snapshot_id                           | None                                                                                                                 |
    | share_network_id                      | c4bfdd5e-7502-4a65-8876-0ce8b9914a64                                                                                 |
    | share_proto                           | NFS                                                                                                                  |
    | metadata                              | {}                                                                                                                   |
    | share_type                            | af7b64ec-cdb3-4a5f-93c9-51672d72e172                                                                                 |
    | is_public                             | False                                                                                                                |
    | snapshot_support                      | True                                                                                                                 |
    | task_state                            | None                                                                                                                 |
    | share_type_name                       | dhss_true                                                                                                            |
    | access_rules_status                   | active                                                                                                               |
    | replication_type                      | None                                                                                                                 |
    | has_replicas                          | False                                                                                                                |
    | user_id                               | 2cebd96a794f431caa06ce5215e0da21                                                                                     |
    | create_share_from_snapshot_support    | True                                                                                                                 |
    | revert_to_snapshot_support            | True                                                                                                                 |
    | share_group_id                        | None                                                                                                                 |
    | source_share_group_snapshot_member_id | None                                                                                                                 |
    | mount_snapshot_support                | True                                                                                                                 |
    | progress                              | 100%                                                                                                                 |
    | export_locations                      |                                                                                                                      |
    |                                       | id = 908e5a28-c5ea-4627-b17c-1cfeb894ccd1                                                                            |
    |                                       | path = 10.0.0.11:/path/to/fake/share/share_83b0772b_00ad_4e45_8fad_106b9d4f1719_da404d59_4280_4b32_847f_6cfa4f730bbd |
    |                                       | preferred = True                                                                                                     |
    |                                       | id = 395244a1-8aa9-44af-9fda-f7d6036ce2b9                                                                            |
    |                                       | path = 10.0.0.10:/path/to/fake/share/share_83b0772b_00ad_4e45_8fad_106b9d4f1719_da404d59_4280_4b32_847f_6cfa4f730bbd |
    |                                       | preferred = False                                                                                                    |
    +---------------------------------------+----------------------------------------------------------------------------------------------------------------------+
    

共享元数据

  • 在您的共享上设置元数据项

    $ manila metadata myshare set purpose='storing financial data for analysis' year_started=2020
    
  • 显示共享元数据

    $ manila metadata-show myshare
    +--------------+-------------------------------------+
    | Property     | Value                               |
    +--------------+-------------------------------------+
    | purpose      | storing financial data for analysis |
    | year_started | 2020                                |
    +--------------+-------------------------------------+
    
  • 使用元数据查询共享列表

    $ manila list --metadata year_started=2020
    +--------------------------------------+---------+------+-------------+-----------+-----------+-----------------+------+-------------------+
    | ID                                   | Name    | Size | Share Proto | Status    | Is Public | Share Type Name | Host | Availability Zone |
    +--------------------------------------+---------+------+-------------+-----------+-----------+-----------------+------+-------------------+
    | 83b0772b-00ad-4e45-8fad-106b9d4f1719 | myshare | 1    | NFS         | available | False     | dhss_true       |      | nova              |
    +--------------------------------------+---------+------+-------------+-----------+-----------+-----------------+------+-------------------+
    
  • 取消设置共享元数据

    $ manila metadata myshare unset year_started
    

共享恢复到快照

  • 共享恢复到快照

    注意

    • 要将共享恢复到其快照,共享的共享类型必须包含 capability extra-spec revert_to_snapshot_support=True

    • 恢复操作只能对共享的最新可用快照进行操作。如果希望恢复到较早的快照,则必须显式删除较后的快照。

    $ manila revert-to-snapshot mysnapshot
    

共享传输

  • 将共享传输到不同的项目

    注意

    • 共享传输适用于 driver_handles_share_servers=False,仅支持传输未使用共享网络创建的共享。

    • 处于转换状态的共享、具有副本的共享或位于共享组中的共享无法传输。

    $ manila share-transfer-create myshare --name mytransfer
    +------------------------+--------------------------------------+
    | Property               | Value                                |
    +------------------------+--------------------------------------+
    | id                     | 1c56314e-7e97-455a-bbde-83828db038d4 |
    | created_at             | 2023-05-25T14:37:11.178869           |
    | name                   | mytransfer                           |
    | resource_type          | share                                |
    | resource_id            | 5573c214-ef79-4fb7-83f8-8c01fbe847f7 |
    | source_project_id      | 88b1f2cf8f554edaa8dd92892d1eabf7     |
    | destination_project_id | None                                 |
    | accepted               | False                                |
    | expires_at             | 2023-05-25T14:42:11.176049           |
    | auth_key               | af429e22e0abc31d                     |
    +------------------------+--------------------------------------+
    
  • 接受共享传输

    注意

    • 共享传输由不同项目中的用户执行。

    $ manila share-transfer-accept 1c56314e-7e97-455a-bbde-83828db038d4  af429e22e0abc31d
    
  • 删除传输

    $ manila share-transfer-delete 1c56314e-7e97-455a-bbde-83828db038d4
    
  • 列出传输

    $ manila share-transfer-list
    +--------------------------------------+------------+---------------+--------------------------------------+
    | ID                                   | Name       | Resource Type | Resource Id                          |
    +--------------------------------------+------------+---------------+--------------------------------------+
    | 1c56314e-7e97-455a-bbde-83828db038d4 | mytransfer | share         | 5573c214-ef79-4fb7-83f8-8c01fbe847f7 |
    +--------------------------------------+------------+---------------+--------------------------------------+
    
  • 显示共享传输

    $ manila share-transfer-show 1c56314e-7e97-455a-bbde-83828db038d4
    +------------------------+--------------------------------------+
    | Property               | Value                                |
    +------------------------+--------------------------------------+
    | id                     | 1c56314e-7e97-455a-bbde-83828db038d4 |
    | created_at             | 2023-05-25T14:37:11.178869           |
    | name                   | mytransfer                           |
    | resource_type          | share                                |
    | resource_id            | 5573c214-ef79-4fb7-83f8-8c01fbe847f7 |
    | source_project_id      | 88b1f2cf8f554edaa8dd92892d1eabf7     |
    | destination_project_id | None                                 |
    | accepted               | False                                |
    | expires_at             | 2023-05-25T14:42:11.176049           |
    +------------------------+--------------------------------------+
    

快照元数据

  • 在创建期间在您的共享快照上设置元数据项

     $ openstack share snapshot create myshare --name mysnapshot \
        --property key1=value1 --property key2=value2
    +-------------------+--------------------------------------+
    | Field             | Value                                |
    +-------------------+--------------------------------------+
    | created_at        | 2024-03-25T15:39:52.555692           |
    | description       | None                                 |
    | id                | 00a82c82-cb49-414b-a334-c1a1e9b360d5 |
    | metadata          | {'key1': 'value1', 'key2': 'value2'} |
    | name              | mysnapshot                           |
    | project_id        | df63c20d921f48d8802083fdb858fd3e     |
    | provider_location | None                                 |
    | share_id          | 6c4d785b-9034-400b-95de-3d4f06280b31 |
    | share_proto       | NFS                                  |
    | share_size        | 1                                    |
    | size              | 1                                    |
    | status            | creating                             |
    | user_id           | b3369f53dadd40499d797a9a4ee9326b     |
    +-------------------+--------------------------------------+
    
  • 在您的共享快照上设置元数据项

    $ openstack share snapshot set mysnapshot --property key1=value
    
  • 使用元数据查询快照列表

    $ openstack share snapshot list --property key1=value1
    +--------------------------------------+------------+
    | ID                                   | Name       |
    +--------------------------------------+------------+
    | 83b0772b-00ad-4e45-8fad-106b9d4f1719 | mysnapshot |
    +--------------------------------------+------------+
    
  • 取消设置快照元数据

    $ openstack share snapshot unset mysnapshot --property key1
    

资源锁

  • 通过创建 resource lock 来防止共享被删除

    $ openstack share lock create myshare share
    +-----------------+--------------------------------------+
    | Field           | Value                                |
    +-----------------+--------------------------------------+
    | created_at      | 2023-07-18T05:11:56.626667           |
    | id              | dc7ec691-a505-47d0-b2ec-8eb7fb9270e4 |
    | lock_context    | user                                 |
    | lock_reason     | None                                 |
    | project_id      | db2e72fef7864bbbbf210f22da7f1158     |
    | resource_action | delete                               |
    | resource_id     | 4c0b4d35-4ea8-4811-a1e2-a065c64225a8 |
    | resource_type   | share                                |
    | updated_at      | None                                 |
    | user_id         | 89de351d3b5744b9853ec4829aa0e714     |
    +-----------------+--------------------------------------+
    

    注意

    共享上的 delete(删除)锁将防止删除以及与删除类似的共享上的其他操作。类似的操作包括将共享移动到回收站以进行延迟删除(soft deletion)或从共享文件系统服务中删除共享(unmanage)。

  • 获取资源锁的详细信息

    $ openstack share lock list --resource myshare --resource-type share
    +--------------------------------------+--------------------------------------+---------------+-----------------+
    | ID                                   | Resource Id                          | Resource Type | Resource Action |
    +--------------------------------------+--------------------------------------+---------------+-----------------+
    | dc7ec691-a505-47d0-b2ec-8eb7fb9270e4 | 4c0b4d35-4ea8-4811-a1e2-a065c64225a8 | share         | delete          |
    +--------------------------------------+--------------------------------------+---------------+-----------------+
    
    $ openstack share lock show dc7ec691-a505-47d0-b2ec-8eb7fb9270e4
    +-----------------+--------------------------------------+
    | Field           | Value                                |
    +-----------------+--------------------------------------+
    | ID              | dc7ec691-a505-47d0-b2ec-8eb7fb9270e4 |
    | Resource Id     | 4c0b4d35-4ea8-4811-a1e2-a065c64225a8 |
    | Resource Type   | share                                |
    | Resource Action | delete                               |
    | Lock Context    | user                                 |
    | User Id         | 89de351d3b5744b9853ec4829aa0e714     |
    | Project Id      | db2e72fef7864bbbbf210f22da7f1158     |
    | Created At      | 2023-07-18T05:11:56.626667           |
    | Updated At      | None                                 |
    | Lock Reason     | None                                 |
    +-----------------+--------------------------------------+
    
  • 资源锁正在运行

    $ openstack share delete myshare
    Failed to delete share with name or ID 'myshare': Resource lock/s [dc7ec691-a505-47d0-b2ec-8eb7fb9270e4] prevent delete action. (HTTP 403) (Request-ID: req-331a8e31-e02a-40b2-accf-0f6dae1b6178)
    1 of 1 shares failed to delete.
    
  • 删除资源锁

    $ openstack share lock delete dc7ec691-a505-47d0-b2ec-8eb7fb9270e4
    

分享备份

  • 创建备份

    $ openstack share backup create --name test5 --backup-options backup_type=eng_data_backup source_share
    +-------------------+--------------------------------------+
    | Field             | Value                                |
    +-------------------+--------------------------------------+
    | availability_zone | manila-zone-0                        |
    | backup_type       | backup_type1                         |
    | created_at        | 2024-03-11T18:15:32.183982           |
    | description       | None                                 |
    | host              | vm.openstack.opendev.com@nas_storage |
    | id                | 4b468327-d03f-4df7-97ef-c5230b5beafc |
    | name              | test5                                |
    | progress          | 0                                    |
    | restore_progress  | 0                                    |
    | share_id          | 983c6dd5-ef93-4c73-9359-ef02fe3bbce7 |
    | size              | 1                                    |
    | status            | creating                             |
    | topic             | None                                 |
    | updated_at        | None                                 |
    +-------------------+--------------------------------------+
    
  • 列出备份

    $ openstack share backup list
    +--------------------------------------+-------+--------------------------------------+-----------+
    | ID                                   | Name  | Share ID                             | Status    |
    +--------------------------------------+-------+--------------------------------------+-----------+
    | 4b468327-d03f-4df7-97ef-c5230b5beafc | test5 | 983c6dd5-ef93-4c73-9359-ef02fe3bbce7 | creating  |
    | 8a9b3ce0-23bb-4923-b8ce-d0dd1f56b2b8 | test4 | 983c6dd5-ef93-4c73-9359-ef02fe3bbce7 | available |
    +--------------------------------------+-------+--------------------------------------+-----------+
    
    $ openstack share backup show test5
    +-------------------+------------------------------------------------+
    | Field             | Value                                          |
    +-------------------+------------------------------------------------+
    | availability_zone | manila-zone-0                                  |
    | backup_type       | backup_type1                                   |
    | created_at        | 2024-03-11T18:15:32.000000                     |
    | description       | None                                           |
    | host              | scs000215254-1.nb.openenglab.netapp.com@ontap1 |
    | id                | 4b468327-d03f-4df7-97ef-c5230b5beafc           |
    | name              | test5                                          |
    | progress          | 0                                              |
    | restore_progress  | 0                                              |
    | share_id          | 983c6dd5-ef93-4c73-9359-ef02fe3bbce7           |
    | size              | 1                                              |
    | status            | creating                                       |
    | topic             | manila-share                                   |
    | updated_at        | 2024-03-11T18:15:32.000000                     |
    +-------------------+------------------------------------------------+
    
    $ openstack share backup list
    +--------------------------------------+-------+--------------------------------------+-----------+
    | ID                                   | Name  | Share ID                             | Status    |
    +--------------------------------------+-------+--------------------------------------+-----------+
    | 4b468327-d03f-4df7-97ef-c5230b5beafc | test5 | 983c6dd5-ef93-4c73-9359-ef02fe3bbce7 | available |
    | 8a9b3ce0-23bb-4923-b8ce-d0dd1f56b2b8 | test4 | 983c6dd5-ef93-4c73-9359-ef02fe3bbce7 | available |
    +--------------------------------------+-------+--------------------------------------+-----------+
    
  • 恢复备份

    $ openstack share backup restore test4
    
    $ openstack share backup list
    +--------------------------------------+-------+--------------------------------------+-----------+
    | ID                                   | Name  | Share ID                             | Status    |
    +--------------------------------------+-------+--------------------------------------+-----------+
    | 4b468327-d03f-4df7-97ef-c5230b5beafc | test5 | 983c6dd5-ef93-4c73-9359-ef02fe3bbce7 | available |
    | 8a9b3ce0-23bb-4923-b8ce-d0dd1f56b2b8 | test4 | 983c6dd5-ef93-4c73-9359-ef02fe3bbce7 | restoring |
    +--------------------------------------+-------+--------------------------------------+-----------+
    
  • 删除备份

    $ openstack share backup delete test5