• Elastic Volume Service

evs
  1. Help Center
  2. Elastic Volume Service
  3. Developer Guide
  4. Creating EVS Disks

Creating EVS Disks

Scenarios

This API is used to create one or multiple EVS disks.

Constraints

None

Involved APIs

Query the AZs before you create EVS disks.

If you need to create system disks, query the image information and obtain the image ID.

If you need to create the disk from a data source, for example a snapshot or backup, query the snapshot or backup information and obtain the snapshot ID or backup ID.

Obtain the required information and then create the disk.

To meet the preceding requirements, call the following APIs:

  • Query AZs.
  • Query images.
  • Query EVS snapshots.
  • Query backups.
  • Create EVS disks.

Procedure

  1. Query the AZs.
    • API information

      URI format: GET /v3/{project_id}/os-availability-zone

      For details, see OpenStack Cinder API v3 > EVS Disk > Querying Information About All AZs in the Elastic Volume Service API Reference.

    • Example request

      GET /v3/9c53a566cb3443ab910cf0daebca90c4/os-availability-zone

    • Example response
       {
          "availabilityZoneInfo": [
              {
                  "zoneState": {
                      "available": true
                  }, 
                  "zoneName": "az1.dc1"
              }, 
              {
                  "zoneState": {
                      "available": true
                  }, 
                  "zoneName": "vmware.az1"
              }
          ]
      }
  2. (Optional) Query the images if system disks are going to be created.
    • API information

      URI format: GET /v2/images

      For details, see API > Image (Native OpenStack APIs) > Querying Images (Native OpenStack API) in the Image Management Service API Reference.

    • Example request

      GET /v2/images

    • Example response
      {
          "images": [
              {
                  "status": "queued", 
                  "name": "test", 
                  "tags": [
                      "test", 
                      "image"
                  ], 
                  "container_format": "bare", 
                  "created_at": "2014-12-16T01:22:05Z", 
                  "disk_format": "qcow2", 
                  "updated_at": "2014-12-16T01:22:05Z", 
                  "visibility": "private", 
                  "self": "/v2/images/4ca46bf1-5c61-48ff-b4f3-0ad4e5e3ba90", 
                  "min_disk": 1, 
                  "protected": false, 
                  "id": "4ca46bf1-5c61-48ff-b4f3-0ad4e5e3ba90", 
                  "file": "/v2/images/4ca46bf1-5c61-48ff-b4f3-0ad4e5e3ba90/file", 
                  "owner": "aed2c611711548a4a9c16fb8fe166af4", 
                  "min_ram": 1024, 
                  "schema": "/v2/schemas/image"
              }, 
              {
                  "status": "active", 
                  "name": "cirros", 
                  "tags": [
                      "new"
                  ], 
                  "container_format": "bare", 
                  "created_at": "2014-12-11T03:53:43Z", 
                  "size": 13147648, 
                  "disk_format": "qcow2", 
                  "updated_at": "2014-12-15T20:02:12Z", 
                  "visibility": "private", 
                  "self": "/v2/images/5155a22a-834e-4ffe-a95d-ed9665a8ed76", 
                  "min_disk": 0, 
                  "protected": false, 
                  "id": "5155a22a-834e-4ffe-a95d-ed9665a8ed76", 
                  "file": "/v2/images/5155a22a-834e-4ffe-a95d-ed9665a8ed76/file", 
                  "checksum": "d972013792949d0d3ba628fbe8685bce", 
                  "owner": "aed2c611711548a4a9c16fb8fe166af4", 
                  "min_ram": 0, 
                  "schema": "/v2/schemas/image"
              }
          ], 
          "schema": "/v2/schemas/images", 
          "first": "/v2/images"
      }
  3. (Optional) Query the EVS snapshots if the disk is going to be created from a snapshot.
    • API information

      URI format: GET /v3/{project_id}/snapshots

      For details, see OpenStack Cinder API v3 > EVS Snapshot > Querying EVS Snapshots in the Elastic Volume Service API Reference.

    • Example request

      GET /v3/9c53a566cb3443ab910cf0daebca90c4/snapshots

    • Example response
      {
          "snapshots": [
              {
                  "created_at": "2016-02-16T16:54:14.981520", 
                  "description": null, 
                  "id": "b836dc3d-4e10-4ea4-a34c-8f6b0460a583", 
                  "metadata": { }, 
                  "name": "test01", 
                  "size": 1, 
                  "status": "available", 
                  "volume_id": "ba5730ea-8621-4ae8-b702-ff0ffc12c209", 
                  "updated_at": null
              }, 
              {
                  "created_at": "2016-02-16T16:54:19.475397", 
                  "description": null, 
                  "id": "83be494d-329e-4a78-8ac5-9af900f48b95", 
                  "metadata": { }, 
                  "name": "test02", 
                  "size": 1, 
                  "status": "available", 
                  "volume_id": "ba5730ea-8621-4ae8-b702-ff0ffc12c209", 
                  "updated_at": null
              }, 
              {
                  "created_at": "2016-02-16T16:54:24.367414", 
                  "description": null, 
                  "id": "dd360f46-7593-4d35-8f2c-5566fd0bd79e", 
                  "metadata": { }, 
                  "name": "test03", 
                  "size": 1, 
                  "status": "available", 
                  "volume_id": "ba5730ea-8621-4ae8-b702-ff0ffc12c209", 
                  "updated_at": null
              }, 
              {
                  "created_at": "2016-02-16T16:54:29.766740", 
                  "description": null, 
                  "id": "4c29796a-8cf4-4482-9afc-e66da9a81240", 
                  "metadata": { }, 
                  "name": "test04", 
                  "size": 1, 
                  "status": "available", 
                  "volume_id": "ba5730ea-8621-4ae8-b702-ff0ffc12c209", 
                  "updated_at": null
              }
          ], 
          "snapshots_links": null
      }
  4. (Optional) Query the backups if the disk is going to be created from a backup.
    • API information

      URI format: GET /v2/{project_id}/backups

      For details, see API Description > Volume Backup Service > Querying Summary Information About VBS Backups (Native OpenStack API) in the Volume Backup Service API Reference.

    • Example request

      GET /v2/9c53a566cb3443ab910cf0daebca90c4/backups

    • Example response
      {
          "backups": [
              {
                  "id": "1d1139d8-8989-49d3-8aa1-83eb691e6db2", 
                  "links": [
                      {
                          "href": "http://192.168.82.222:8776/v2/b23b579f08c84228b9b4673c46f0c442/backups/1d1139d8-8989-49d3-8aa1-83eb691e6db2", 
                          "rel": "self"
                      }, 
                      {
                          "href": "http://192.168.82.222:8776/b23b579f08c84228b9b4673c46f0c442/backups/1d1139d8-8989-49d3-8aa1-83eb691e6db2", 
                          "rel": "bookmark"
                      }
                  ], 
                  "name": null
              }, 
              {
                  "id": "b3cf7a16-decc-4beb-8077-682737d94a58", 
                  "links": [
                      {
                          "href": "http://192.168.82.222:8776/v2/b23b579f08c84228b9b4673c46f0c442/backups/b3cf7a16-decc-4beb-8077-682737d94a58", 
                          "rel": "self"
                      }, 
                      {
                          "href": "http://192.168.82.222:8776/b23b579f08c84228b9b4673c46f0c442/backups/b3cf7a16-decc-4beb-8077-682737d94a58", 
                          "rel": "bookmark"
                      }
                  ], 
                  "name": null
              }
          ], 
          "backups_links": [
              {
                  "href": "http://192.168.82.222:8776/b23b579f08c84228b9b4673c46f0c442/backups?limit=1&offset=1&marker=b3cf7a16-decc-4beb-8077-682737d94a58", 
                  "rel": "next"
              }
          ]
      }
  5. Create EVS disks.
    • API information

      URI format: POST /v3/{project_id}/volumes

      For details, see OpenStack Cinder API v3 > EVS Disk > Creating EVS Disks in the Elastic Volume Service API Reference.

    • Example request

      POST /v3/9c53a566cb3443ab910cf0daebca90c4/volumes

      {

      "volume": {

      "name": "openapi_vol01",

      "imageRef": "027cf713-45a6-45f0-ac1b-0ccc57ac12e2",

      "availability_zone": "xxx",

      "description": "create for api test",

      "volume_type": "SATA",

      "metadata": {

      "volume_owner": "openapi"

      },

      "consistencygroup_id": null,

      "OS-SCH-HNT:scheduler_hints": {

      "dedicated_storage_id": "eddc1a3e-4145-45be-98d7-bf6f65af9767"

      },

      "source_volid": null,

      "snapshot_id": null,

      "shareable": "false",

      "multiattach": false,

      "source_replica": null,

      "size": 40

      }

      }

    • Example response
      {
          "volume": {
              "attachments": [ ], 
              "availability_zone": "xxx", 
              "bootable": "false", 
              "consistencygroup_id": null, 
              "created_at": "2016-05-25T02:38:40.392463", 
              "description": "create for api test", 
              "encrypted": false, 
              "id": "8dd7c486-8e9f-49fe-bceb-26aa7e312b66", 
              "links": [
                  {
                      "href": "https://volume.localdomain.com:8776/v2/5dd0b0056f3d47b6ab4121667d35621a/volumes/8dd7c486-8e9f-49fe-bceb-26aa7e312b66", 
                      "rel": "self"
                  }, 
                  {
                      "href": "https://volume.localdomain.com:8776/5dd0b0056f3d47b6ab4121667d35621a/volumes/8dd7c486-8e9f-49fe-bceb-26aa7e312b66", 
                      "rel": "bookmark"
                  }
              ], 
              "metadata": {
                  "volume_owner": "openapi"
              }, 
              "name": "openapi_vol01", 
              "replication_status": "disabled", 
              "shareable": false, 
              "multiattach": false, 
              "size": 40, 
              "snapshot_id": null, 
              "source_volid": null, 
              "status": "creating", 
              "updated_at": null, 
              "user_id": "39f6696ae23740708d0f358a253c2637", 
              "volume_type": "SATA"
          }
      }
      or
      {
          "error": {
              "message": "XXXX", 
              "code": "XXX"
          }
      }
      In the preceding example, error indicates a general error, for example,  badRequest or  itemNotFound. An example is provided as follows:
      {
          "badRequest": {
              "message": "XXXX", 
              "code": "XXX"
          }
      }