排查异步失败

共享文件系统服务执行许多用户操作,均为异步方式。例如,当创建新的共享时,请求会立即得到确认,并包含共享元数据的响应。用户随后可以查询资源,并检查共享的 status 属性。通常,...ing 状态表示正在异步执行操作。例如,新共享的 status 属性由服务设置为 creating。如果这些异步操作失败,资源的 status 将被设置为 error。可以使用 CLI 客户端获取更多错误信息。

场景

在此示例中,用户希望创建一个共享来托管多个虚拟机上的软件库。该示例故意引入两次共享创建失败,以说明如何使用命令行检索用户支持消息。

  1. 为了创建共享,您需要指定满足您要求的共享类型。云管理员创建共享类型;请参阅这些可用的共享类型

    clouduser1@client:~$ openstack share type list
    +--------------------------------------+------------+------------+------------+--------------------------------------+-------------------------------------------+-------------+
    | ID                                   | Name       | Visibility | Is Default | Required Extra Specs                 | Optional Extra Specs                      | Description |
    +--------------------------------------+------------+------------+------------+--------------------------------------+-------------------------------------------+-------------+
    | 61c7e7d2-ce74-4b50-9a3d-a89f7c51b9e9 | default    | public     | True       | driver_handles_share_servers : False | snapshot_support : True                   | None        |
    |                                      |            |            |            |                                      | create_share_from_snapshot_support : True |             |
    |                                      |            |            |            |                                      | revert_to_snapshot_support : True         |             |
    |                                      |            |            |            |                                      | mount_snapshot_support : True             |             |
    | 8867fc92-3193-4c6d-8248-a6ba10aa974b | dhss_false | public     | False      | driver_handles_share_servers : False | snapshot_support : True                   | None        |
    |                                      |            |            |            |                                      | create_share_from_snapshot_support : True |             |
    |                                      |            |            |            |                                      | revert_to_snapshot_support : True         |             |
    |                                      |            |            |            |                                      | mount_snapshot_support : True             |             |
    | 4d754228-5b5d-4632-8f96-0c27dcb7968f | dhss_true  | public     | False      | driver_handles_share_servers : True  | snapshot_support : True                   | None        |
    |                                      |            |            |            |                                      | create_share_from_snapshot_support : True |             |
    |                                      |            |            |            |                                      | revert_to_snapshot_support : True         |             |
    |                                      |            |            |            |                                      | mount_snapshot_support : True             |             |
    +--------------------------------------+------------+------------+------------+--------------------------------------+-------------------------------------------+-------------+
    

    在此示例中,有三种共享类型可用。

  2. 要使用指定 driver_handles_share_servers=True 功能的共享类型,您必须创建一个“共享网络”来导出共享。

    clouduser1@client:~$ openstack subnet list
    +--------------------------------------+---------------------+--------------------------------------+---------------------+
    | ID                                   | Name                | Network                              | Subnet              |
    +--------------------------------------+---------------------+--------------------------------------+---------------------+
    | 01efb9d0-4c5f-424a-8402-b3bf19d0e4a2 | shared-subnet       | b8b3fedf-f788-4ba4-bf55-24521a20e671 | 192.168.233.0/24    |
    | 54a3188e-8bf2-461a-8b70-0d63f05810a6 | private-subnet      | 0bea5e39-81ce-4d6f-845d-ce5e87dad7d3 | 10.0.0.0/26         |
    | 6d1b41b2-8b39-482d-8e46-10bec65cdc99 | ipv6-public-subnet  | 9d25eb3b-d76c-4429-b788-a3dab0f2c24d | 2001:db8::/64       |
    | 8805a23b-b35e-42fe-8502-4f4bc58d23f7 | public-subnet       | 9d25eb3b-d76c-4429-b788-a3dab0f2c24d | 172.24.4.0/24       |
    | 9f8ae84a-5375-42f7-aa1b-eb3b697e8e3a | ipv6-private-subnet | 0bea5e39-81ce-4d6f-845d-ce5e87dad7d3 | fda4:5834:1c78::/64 |
    +--------------------------------------+---------------------+--------------------------------------+---------------------+
    
  3. 从私有租户网络创建“共享网络”

    clouduser1@client:~$ openstack share network create --name mynet \
                        --neutron-net-id 0bea5e39-81ce-4d6f-845d-ce5e87dad7d3 \
                        --neutron-subnet-id 54a3188e-8bf2-461a-8b70-0d63f05810a6
    +-----------------------------------+----------------------------------------------------------+
    | Field                             | Value                                                    |
    +-----------------------------------+----------------------------------------------------------+
    | created_at                        | 2025-04-16T18:39:17.582629                               |
    | description                       | None                                                     |
    | id                                | b6cc0aa0-c6bf-4c28-9566-a4bff93382d9                     |
    | name                              | mynet                                                    |
    | network_allocation_update_support | True                                                     |
    | project_id                        | 138d700333eb46cfb36b5a9659704759                         |
    | security_service_update_support   | True                                                     |
    | share_network_subnets             |                                                          |
    |                                   | id = 4114b63b-4932-4082-b5c9-e50dc839d3c9                |
    |                                   | availability_zone = None                                 |
    |                                   | created_at = 2025-04-16T18:39:17.607997                  |
    |                                   | updated_at = None                                        |
    |                                   | segmentation_id = None                                   |
    |                                   | neutron_net_id = 0bea5e39-81ce-4d6f-845d-ce5e87dad7d3    |
    |                                   | neutron_subnet_id = 54a3188e-8bf2-461a-8b70-0d63f05810a6 |
    |                                   | ip_version = None                                        |
    |                                   | cidr = None                                              |
    |                                   | network_type = None                                      |
    |                                   | mtu = None                                               |
    |                                   | gateway = None                                           |
    |                                   | metadata = {}                                            |
    | status                            | active                                                   |
    | updated_at                        | None                                                     |
    +-----------------------------------+----------------------------------------------------------+
    
    
    clouduser1@client:~$  openstack share network list
    +--------------------------------------+-------+
    | ID                                   | Name  |
    +--------------------------------------+-------+
    | b6cc0aa0-c6bf-4c28-9566-a4bff93382d9 | mynet |
    +--------------------------------------+-------+
    
  4. 创建共享

    clouduser1@client:~$ openstack share create nfs 1 --name software_share \
                         --share-network mynet --share-type dhss_true
    +---------------------------------------+----------------------------------------------------------------------------------------------------------------------+
    | Field                                 | Value                                                                                                                |
    +---------------------------------------+----------------------------------------------------------------------------------------------------------------------+
    | access_rules_status                   | active                                                                                                               |
    | availability_zone                     | manila-zone-2                                                                                                        |
    | create_share_from_snapshot_support    | True                                                                                                                 |
    | created_at                            | 2025-04-22T16:00:19.973764                                                                                           |
    | description                           | None                                                                                                                 |
    | export_locations                      |                                                                                                                      |
    |                                       | id = 208c9cb5-853d-41c2-82ae-42c10c11d226                                                                            |
    |                                       | path = 10.0.0.10:/path/to/fake/share/share_18b84ece_fb8e_438c_b89b_bb2e7c69a5a0_013ca955_c1ca_4817_b053_d153e6bb5253 |
    |                                       | preferred = True                                                                                                     |
    |                                       | metadata = {}                                                                                                        |
    |                                       | id = 5f2f0201-4d68-48c9-a650-be59692a495f                                                                            |
    |                                       | path = 10.0.0.11:/path/to/fake/share/share_18b84ece_fb8e_438c_b89b_bb2e7c69a5a0_013ca955_c1ca_4817_b053_d153e6bb5253 |
    |                                       | preferred = False                                                                                                    |
    |                                       | metadata = {}                                                                                                        |
    | has_replicas                          | False                                                                                                                |
    | id                                    | 18b84ece-fb8e-438c-b89b-bb2e7c69a5a0                                                                                 |
    | is_public                             | False                                                                                                                |
    | is_soft_deleted                       | False                                                                                                                |
    | mount_snapshot_support                | True                                                                                                                 |
    | name                                  | software_share                                                                                                       |
    | progress                              | 100%                                                                                                                 |
    | project_id                            | 138d700333eb46cfb36b5a9659704759                                                                                     |
    | properties                            |                                                                                                                      |
    | replication_type                      | None                                                                                                                 |
    | revert_to_snapshot_support            | True                                                                                                                 |
    | scheduled_to_be_deleted_at            | None                                                                                                                 |
    | share_group_id                        | None                                                                                                                 |
    | share_network_id                      | b6cc0aa0-c6bf-4c28-9566-a4bff93382d9                                                                                 |
    | share_proto                           | NFS                                                                                                                  |
    | share_type                            | 4d754228-5b5d-4632-8f96-0c27dcb7968f                                                                                 |
    | share_type_name                       | dhss_true                                                                                                            |
    | size                                  | 1                                                                                                                    |
    | snapshot_id                           | None                                                                                                                 |
    | snapshot_support                      | True                                                                                                                 |
    | source_backup_id                      | None                                                                                                                 |
    | source_share_group_snapshot_member_id | None                                                                                                                 |
    | status                                | available                                                                                                            |
    | task_state                            | None                                                                                                                 |
    | user_id                               | c01b2bd0b56949508d27aebdf04c6d69                                                                                     |
    | volume_type                           | dhss_true                                                                                                            |
    +---------------------------------------+----------------------------------------------------------------------------------------------------------------------+
    
  5. 查看共享状态

    clouduser1@client:~$ openstack share list
    +--------------------------------------+------------------+------+-------------+--------+-----------+-----------------+------+-------------------+
    | ID                                   | Name             | Size | Share Proto | Status | Is Public | Share Type Name | Host | Availability Zone |
    +--------------------------------------+------------------+------+-------------+--------+-----------+-----------------+------+-------------------+
    | 18b84ece-fb8e-438c-b89b-bb2e7c69a5a0 | software_share   |    1 | NFS         | error  | False     | dhss_true       |      | None              |
    +--------------------------------------+------------------+------+-------------+--------+-----------+-----------------+------+-------------------+
    

    在此示例中,共享创建过程中发生错误。

  6. 要查看生成的用户消息,请使用 message-list 命令。使用 --resource-id 过滤特定共享资源的消息。

    clouduser1@client:~$ openstack share message list
    +--------------------------------------+---------------+--------------------------------------+-----------+-----------------------------------------------------+-----------+----------------------------+
    | ID                                   | Resource Type | Resource ID                          | Action ID | User Message                                        | Detail ID | Created At                 |
    +--------------------------------------+---------------+--------------------------------------+-----------+-----------------------------------------------------+-----------+----------------------------+
    | 8fe74a26-f57d-4961-8435-5ea8ccf05946 | SHARE         | 18b84ece-fb8e-438c-b89b-bb2e7c69a5a0 | 001       | allocate host: No storage could be allocated for    | 008       | 2025-04-22T20:16:50.207084 |
    |                                      |               |                                      |           | this share request, Capabilities filter didn't      |           |                            |
    |                                      |               |                                      |           | succeed.                                            |           |                            |
    +--------------------------------------+---------------+--------------------------------------+-----------+-----------------------------------------------------+-----------+----------------------------+
    

    在用户消息列中,您可以看到共享文件系统服务由于功能不匹配而无法创建共享。

  7. 要查看更多信息,请使用 message-show 命令,后跟来自 message-list 命令的消息 ID

    clouduser1@client:~$ openstack share message-show 8fe74a26-f57d-4961-8435-5ea8ccf05946
    +---------------+----------------------------------------------------------------------------------------------------------+
    | Field         | Value                                                                                                    |
    +---------------+----------------------------------------------------------------------------------------------------------+
    | id            | 8fe74a26-f57d-4961-8435-5ea8ccf05946                                                                     |
    | resource_type | SHARE                                                                                                    |
    | resource_id   | 18b84ece-fb8e-438c-b89b-bb2e7c69a5a0                                                                     |
    | action_id     | 001                                                                                                      |
    | user_message  | allocate host: No storage could be allocated for this share request, Capabilities filter didn't succeed. |
    | message_level | ERROR                                                                                                    |
    | detail_id     | 008                                                                                                      |
    | created_at    | 2025-04-22T20:16:50.207084                                                                               |
    | expires_at    | 2025-05-22T20:16:50.000000                                                                               |
    | request_id    | req-1621b77d-0abb-4c90-9e61-8809214f58a6                                                                 |
    +---------------+----------------------------------------------------------------------------------------------------------+
    

    作为云用户,您知道您的共享类型具有相关的规范,因此您可以查看可用的共享类型。这两个共享类型之间的区别是 driver_handles_share_servers 的值

    clouduser1@client:~$ openstack share type list
    +--------------------------------------+------------+------------+------------+--------------------------------------+-------------------------------------------+-------------+
    | ID                                   | Name       | Visibility | Is Default | Required Extra Specs                 | Optional Extra Specs                      | Description |
    +--------------------------------------+------------+------------+------------+--------------------------------------+-------------------------------------------+-------------+
    | 61c7e7d2-ce74-4b50-9a3d-a89f7c51b9e9 | default    | public     | True       | driver_handles_share_servers : False | snapshot_support : True                   | None        |
    |                                      |            |            |            |                                      | create_share_from_snapshot_support : True |             |
    |                                      |            |            |            |                                      | revert_to_snapshot_support : True         |             |
    |                                      |            |            |            |                                      | mount_snapshot_support : True             |             |
    | 8867fc92-3193-4c6d-8248-a6ba10aa974b | dhss_false | public     | False      | driver_handles_share_servers : False | snapshot_support : True                   | None        |
    |                                      |            |            |            |                                      | create_share_from_snapshot_support : True |             |
    |                                      |            |            |            |                                      | revert_to_snapshot_support : True         |             |
    |                                      |            |            |            |                                      | mount_snapshot_support : True             |             |
    | 4d754228-5b5d-4632-8f96-0c27dcb7968f | dhss_true  | public     | False      | driver_handles_share_servers : True  | snapshot_support : True                   | None        |
    |                                      |            |            |            |                                      | create_share_from_snapshot_support : True |             |
    |                                      |            |            |            |                                      | revert_to_snapshot_support : True         |             |
    |                                      |            |            |            |                                      | mount_snapshot_support : True             |             |
    +--------------------------------------+------------+------------+------------+--------------------------------------+-------------------------------------------+-------------+
    
  8. 使用另一个可用的共享类型创建共享

    clouduser1@client:~$ openstack share create nfs 1 --name software_share \
                        --share-network mynet --share-type dhss_false
    +---------------------------------------+--------------------------------------+
    | Field                                 | Value                                |
    +---------------------------------------+--------------------------------------+
    | access_rules_status                   | active                               |
    | availability_zone                     | None                                 |
    | create_share_from_snapshot_support    | True                                 |
    | created_at                            | 2025-04-22T20:34:04.627679           |
    | description                           | None                                 |
    | has_replicas                          | False                                |
    | id                                    | 010e4c5b-d40a-4691-a7cb-68c3b3950523 |
    | is_public                             | False                                |
    | is_soft_deleted                       | False                                |
    | metadata                              | {}                                   |
    | mount_snapshot_support                | True                                 |
    | name                                  | software_share                       |
    | progress                              | None                                 |
    | project_id                            | 138d700333eb46cfb36b5a9659704759     |
    | replication_type                      | None                                 |
    | revert_to_snapshot_support            | True                                 |
    | scheduled_to_be_deleted_at            | None                                 |
    | share_group_id                        | None                                 |
    | share_network_id                      | b6cc0aa0-c6bf-4c28-9566-a4bff93382d9 |
    | share_proto                           | NFS                                  |
    | share_type                            | 8867fc92-3193-4c6d-8248-a6ba10aa974b |
    | share_type_name                       | dhss_false                           |
    | size                                  | 1                                    |
    | snapshot_id                           | None                                 |
    | snapshot_support                      | True                                 |
    | source_backup_id                      | None                                 |
    | source_share_group_snapshot_member_id | None                                 |
    | status                                | creating                             |
    | task_state                            | None                                 |
    | user_id                               | c01b2bd0b56949508d27aebdf04c6d69     |
    | volume_type                           | dhss_false                           |
    +---------------------------------------+--------------------------------------+
    

    在此示例中,第二次共享创建尝试失败。

  9. 查看用户支持消息

    clouduser1@client:~$ openstack share list
    +--------------------------------------+------------------+------+-------------+--------+-----------+-----------------+------+-------------------+
    | ID                                   | Name             | Size | Share Proto | Status | Is Public | Share Type Name | Host | Availability Zone |
    +--------------------------------------+------------------+------+-------------+--------+-----------+-----------------+------+-------------------+
    | 18b84ece-fb8e-438c-b89b-bb2e7c69a5a0 | software_share   |    1 | NFS         | error  | False     | dhss_true       |      | None              |
    | 010e4c5b-d40a-4691-a7cb-68c3b3950523 | software_share   |    1 | NFS         | error  | False     | dhss_false      |      | manila-zone-1     |
    +--------------------------------------+------------------+------+-------------+--------+-----------+-----------------+------+-------------------+
    
    
    clouduser1@client:~$ openstack share message list
    +--------------------------------------+---------------+--------------------------------------+-----------+-----------------------------------------------------+-----------+----------------------------+
    | ID                                   | Resource Type | Resource ID                          | Action ID | User Message                                        | Detail ID | Created At                 |
    +--------------------------------------+---------------+--------------------------------------+-----------+-----------------------------------------------------+-----------+----------------------------+
    | 50a401e8-c30a-4369-8a35-68a019d19c76 | SHARE         | 010e4c5b-d40a-4691-a7cb-68c3b3950523 | 002       | create: Driver does not expect share-network to be  | 003       | 2025-04-22T20:34:04.810870 |
    |                                      |               |                                      |           | provided with current configuration.                |           |                            |
    | 8fe74a26-f57d-4961-8435-5ea8ccf05946 | SHARE         | 18b84ece-fb8e-438c-b89b-bb2e7c69a5a0 | 001       | allocate host: No storage could be allocated for    | 008       | 2025-04-22T20:16:50.207084 |
    |                                      |               |                                      |           | this share request, Capabilities filter didn't      |           |                            |
    |                                      |               |                                      |           | succeed.                                            |           |                            |
    +--------------------------------------+---------------+--------------------------------------+-----------+-----------------------------------------------------+-----------+----------------------------+
    

    您可以看到该服务不期望为所使用的共享类型使用共享网络。在不咨询管理员的情况下,您可以发现管理员尚未提供支持直接导出到您的私有 neutron 网络的存储后端。

  10. 不使用 --share-network 参数创建共享

    clouduser1@client:~$ openstack share create nfs 1 --name software_share \
                        --share-type dhss_false
    +---------------------------------------+--------------------------------------+
    | Field                                 | Value                                |
    +---------------------------------------+--------------------------------------+
    | access_rules_status                   | active                               |
    | availability_zone                     | None                                 |
    | create_share_from_snapshot_support    | True                                 |
    | created_at                            | 2025-04-22T21:48:37.025207           |
    | description                           | None                                 |
    | has_replicas                          | False                                |
    | id                                    | feec61e2-4166-4ca3-8d59-a8d13f78535e |
    | is_public                             | False                                |
    | is_soft_deleted                       | False                                |
    | metadata                              | {}                                   |
    | mount_snapshot_support                | True                                 |
    | name                                  | software_share                       |
    | progress                              | None                                 |
    | project_id                            | 138d700333eb46cfb36b5a9659704759     |
    | replication_type                      | None                                 |
    | revert_to_snapshot_support            | True                                 |
    | scheduled_to_be_deleted_at            | None                                 |
    | share_group_id                        | None                                 |
    | share_network_id                      | None                                 |
    | share_proto                           | NFS                                  |
    | share_type                            | 8867fc92-3193-4c6d-8248-a6ba10aa974b |
    | share_type_name                       | dhss_false                           |
    | size                                  | 1                                    |
    | snapshot_id                           | None                                 |
    | snapshot_support                      | True                                 |
    | source_backup_id                      | None                                 |
    | source_share_group_snapshot_member_id | None                                 |
    | status                                | creating                             |
    | task_state                            | None                                 |
    | user_id                               | c01b2bd0b56949508d27aebdf04c6d69     |
    | volume_type                           | dhss_false                           |
    +---------------------------------------+--------------------------------------+
    
  11. 为了确保共享已成功创建,请使用 share list 命令

    clouduser1@client:~$ openstack share list
    +--------------------------------------+------------------+------+-------------+-----------+-----------+-----------------+------+-------------------+
    | ID                                   | Name             | Size | Share Proto | Status    | Is Public | Share Type Name | Host | Availability Zone |
    +--------------------------------------+------------------+------+-------------+-----------+-----------+-----------------+------+-------------------+
    | 18b84ece-fb8e-438c-b89b-bb2e7c69a5a0 | software_share   |    1 | NFS         | error     | False     | dhss_true       |      | None              |
    | feec61e2-4166-4ca3-8d59-a8d13f78535e | software_share   |    1 | NFS         | available | False     | dhss_false      |      | manila-zone-1     |
    | 010e4c5b-d40a-4691-a7cb-68c3b3950523 | software_share   |    1 | NFS         | error     | False     | dhss_false      |      | manila-zone-1     |
    +--------------------------------------+------------------+------+-------------+-----------+-----------+-----------------+------+-------------------+
    
  12. 删除创建失败的共享和相应的支持消息

    clouduser1@client:~$ openstack share delete \
                         18b84ece-fb8e-438c-b89b-bb2e7c69a5a0 \
                         010e4c5b-d40a-4691-a7cb-68c3b3950523
    clouduser1@client:~$ openstack share message list
    +--------------------------------------+---------------+--------------------------------------+-----------+-----------------------------------------------------+-----------+----------------------------+
    | ID                                   | Resource Type | Resource ID                          | Action ID | User Message                                        | Detail ID | Created At                 |
    +--------------------------------------+---------------+--------------------------------------+-----------+-----------------------------------------------------+-----------+----------------------------+
    | 50a401e8-c30a-4369-8a35-68a019d19c76 | SHARE         | 010e4c5b-d40a-4691-a7cb-68c3b3950523 | 002       | create: Driver does not expect share-network to be  | 003       | 2025-04-22T20:34:04.810870 |
    |                                      |               |                                      |           | provided with current configuration.                |           |                            |
    | 8fe74a26-f57d-4961-8435-5ea8ccf05946 | SHARE         | 18b84ece-fb8e-438c-b89b-bb2e7c69a5a0 | 001       | allocate host: No storage could be allocated for    | 008       | 2025-04-22T20:16:50.207084 |
    |                                      |               |                                      |           | this share request, Capabilities filter didn't      |           |                            |
    |                                      |               |                                      |           | succeed.                                            |           |                            |
    +--------------------------------------+---------------+--------------------------------------+-----------+-----------------------------------------------------+-----------+----------------------------+
    
    
    clouduser1@client:~$ openstack share message delete \
                         50a401e8-c30a-4369-8a35-68a019d19c76 \
                         8fe74a26-f57d-4961-8435-5ea8ccf05946
    
    clouduser1@client:~$ openstack share message list
    +----+---------------+-------------+-----------+--------------+-----------+------------+
    | ID | Resource Type | Resource ID | Action ID | User Message | Detail ID | Created At |
    +----+---------------+-------------+-----------+--------------+-----------+------------+
    +----+---------------+-------------+-----------+--------------+-----------+------------+