Atšķirības starp "Hostnet OpenStack Cloud Volume API" versijām

No ''Hostnet Wiki''
Pārlēkt uz: navigācija, meklēt
(Jauna lapa: Example with using curl. Once you have these pieces of information, you can pass them into the SDK by replacing {username}, {password} and {projectID} with your info: {username}, {p...)
(Nav atšķirību)

Versija, kas saglabāta 2017. gada 6. jūnijs, plkst. 14.29

Example with using curl.

Once you have these pieces of information, you can pass them into the SDK by replacing {username}, {password} and {projectID} with your info:

{username}, {password} below are placeholders, do not enclose '{}' when you replace them with actual credentials.

curl -i \
  -H "Content-Type: application/json" \
  -d '
{ "auth": {
    "identity": {
      "methods": [
        "password"
      ],
      "password": {
        "user": {
          "name": "{username}",
          "domain": {
            "id": "default"
          },
          "password": "{password}"
        }
      }
    },
    "scope": {
      "project": {
        "id": "{projectID}"
      }
    }
  }
}' \
  https://identity.api.cloud.hostnet.lv/v3/auth/tokens
  1. From the resulting, set environment variable as X-Subject-Token value:
export OS_TOKEN="{X-Subject-Token}"
  1. Get volume service endpoints:
curl -s -X GET https://identity.api.cloud.hostnet.lv/v3/auth/catalog \
  -H "X-Auth-Token: $OS_TOKEN" | python -m json.tool

# Set env variable for public compute, image and network endpoints:
export VOL_ENDPOINT="{volumeURL}"

We provide three volume endpoints - volume, volumev2 and volumev3. Volumev3 and volume have same type endpoints.

  1. Create blank volume
curl -s $VOL_ENDPOINT/volumes \
  -X POST \
  -H "X-Auth-Token: $OS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '
{ "volume": {
    "size": 10,
    "name": "MyNewVolume"
  }
}' | python -m json.tool

Response:

{
    "volume": {
        "attachments": [],
        "availability_zone": "hostnet-1",
        "bootable": "false",
        "consistencygroup_id": null,
        "created_at": "2017-06-06T14:27:51.694790",
        "description": null,
        "encrypted": false,
        "id": "99b6cfc2-513a-4275-99fc-cc3be8814593",
        "links": [
            {
                "href": "https://volume.api.cloud.hostnet.lv/v3/86320c4cde114196a211b49d3ba9c5f3/volumes/99b6cfc2-513a-4275-99fc-cc3be8814593",
                "rel": "self"
            },
            {
                "href": "https://volume.api.cloud.hostnet.lv/86320c4cde114196a211b49d3ba9c5f3/volumes/99b6cfc2-513a-4275-99fc-cc3be8814593",
                "rel": "bookmark"
            }
        ],
        "metadata": {},
        "multiattach": false,
        "name": "MyNewVolume",
        "replication_status": "disabled",
        "size": 10,
        "snapshot_id": null,
        "source_volid": null,
        "status": "creating",
        "updated_at": null,
        "user_id": "96354895967c45cdbc57e28e4fbad851",
        "volume_type": "HA-SAS-disk-NETAPP"
    }
}