更新时间:2024-01-02 gmt 08:00

创建云硬盘-凯发k8国际娱乐官网入口

操作场景

本章节指导用户通过api创建云硬盘。api的调用方法请参见。

以从快照创建云硬盘为例。

前提条件

您需要规划云硬盘所在的区域信息,并根据区域确定调用api的endpoint,详细信息请参见。

操作步骤

  1. 从快照创建云硬盘,请先查询云硬盘快照列表,获取快照信息。

    api:查询云硬盘快照详情列表

    • 请求样例

      get https://{endpoint}/v2/ba546eb46e7247c9aadb566ed7a1d31f/cloudsnapshots/detail

    • 响应样例
      {
        "count": 1,
        "snapshots": [
          {
            "status": "available",
            "description": null,
            "metadata": {},
            "size": 40,
            "id": "0b126d3b-f2af-404d-8d39-a42fce70065a",
            "name": "snapshot-test",
            "created_at": "2019-06-18t12:47:33.700070",
            "updated_at": "2019-06-18t12:47:38.234689",
            "volume_id": "037cf89a-8cea-4d63-ac57-345c0ffccfc2",
            "os-extended-snapshot-attributes:project_id": "ba546eb46e7247c9aadb566ed7a1d31f",
            "os-extended-snapshot-attributes:progress": "100%",
            "service_type": "evs"
          }
        ]
      }

    回显中的“id”即为快照的id。

  2. 通过快照id创建云硬盘。

    api:创建云硬盘

    • 请求样例
      post https://{endpoint}/v2.1/ba546eb46e7247c9aadb566ed7a1d31f/cloudvolumes
      {
          "volume": {
              "count": 1, 
              "availability_zone": "az-dc-1", 
              "description": "test_volume_1", 
              "size": 120, 
              "snapshot_id": "0b126d3b-f2af-404d-8d39-a42fce70065a", 
              "name": "test_volume_1", 
              "volume_type": "sata"
          }
      }
    • 响应样例
      {
        "job_id": "ff8080816b512df7016b6ab8982b496b"
      }
分享:
网站地图