Updated on 2024-02-27 GMT+08:00

Creating an EVS Disk

Scenarios

This section describes how to create an EVS disk by calling APIs. For details about how to call APIs, see Calling APIs.

In the following example, APIs are called to create a disk from a snapshot.

Prerequisites

You have planned the region where you want to create the disk and obtained the endpoint required for API calls. For details, see Endpoints.

Procedure

  1. Query the snapshots and obtain information of the snapshot you desire.

    API: Querying Details About EVS Snapshots
    • Example request

      https://{endpoint}/v2/ba546eb46e7247c9aadb566ed7a1d31f/snapshots/detail

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

    In the response, id indicates the snapshot ID.

  2. Create a disk from a snapshot.

    API: Creating EVS Disks

    • Example request
      POST https://{endpoint}/v2/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"
          }
      }
    • Example response
      {
        "job_id": "ff8080816b512df7016b6ab8982b496b"
      }