获取操作信息

本页面介绍如何获取有关 Filestore 操作的状态信息和其他元数据。

准备工作

您只能使用 gcloud CLI 获取操作信息。如需使用 gcloud CLI,您必须安装 gcloud CLI 或使用 Google Cloud 控制台内置的 Cloud Shell

转到 Google Cloud 控制台

获取有关所有操作的信息

您可以通过运行 operations list 命令来获取 Filestore 操作的列表:

gcloud filestore operations list
    --[project=project-id] \
    --[zone=zone]

其中:

  • project-id 是包含该 Filestore 实例的 Google Cloud 项目的 ID。如果 Filestore 实例位于 gcloud 默认项目中,则可以跳过此标志。您可以通过运行以下命令来设置默认项目:

    gcloud config set project project-id
    
  • zone 是 Filestore 实例所在的区域。运行 gcloud filestore zones list 命令以获取受支持区域的列表。如果 Filestore 实例位于 gcloud 默认地区,则可以跳过此标志。您可以通过运行以下命令来设置默认区域:

    gcloud config set filestore/zone zone
    

命令会返回类似于如下所示的响应:

OPERATION_NAME                                           LOCATION        TYPE    TARGET   STATUS  CREATE_TIME          DURATION
operation-1505929956434-559a2a41c217c-231e6a94-a4b6a803  us-central1-c   create  nfs1     DONE    2017-09-20T17:52:36  <1S    2017-09-20T18:13:00 operation-1505931180862-559a2ed176d0d-a0d70ae0-35ef2e71 europe-west1-b create nfs2 DONE><1S
>

获取有关特定操作的信息

您可以通过运行 operations describe 命令来获取特定 Filestore 操作的详细信息:

gcloud filestore operations describe operation-name \
    --[project=project-id] \
    --[zone=zone]

其中:

  • operation-name 是 Filestore 操作的名称。 使用 operations list 命令获取操作名称列表。
  • project-id 是包含该 Filestore 实例的 Google Cloud 项目的 ID。如果 Filestore 实例位于 gcloud 默认项目中,则可以跳过此标志。您可以通过运行以下命令来设置默认项目:

    gcloud config set project project-id
    
  • zone 是 Filestore 实例所在的区域。运行 gcloud filestore zones list 命令以获取受支持区域的列表。如果 Filestore 实例位于 gcloud 默认区域,则可以跳过此标志。您可以通过运行 config set filestore/zone 命令设置默认区域:

    gcloud config set filestore/zone zone
    

命令会返回类似于如下所示的响应:

done: true
metadata:
  '@type': type.googleapis.com/google.cloud.common.OperationMetadata
  apiVersion: v1beta1
  createTime: '2017-10-09T22:18:09.347400Z'
  endTime: '2017-10-09T22:20:04.392199183Z'
  target: projects/filestore-test/locations/us-central1-c/instances/filer3
  verb: delete
name: projects/filestore-test/locations/us-central1-c/operations/operation-1507587489330-55b2490c4f394-faece090-1c0e16db