Atšķirības starp "Hostnet OpenStack Cloud Volume API" versijām
No ''Hostnet Wiki''
| (1 starpversija, ko mainījis viens dalībnieks, nav parādīta) | |||
| 44. rindiņa: | 44. rindiņa: | ||
curl -s -X GET https://identity.api.cloud.hostnet.lv/v3/auth/catalog \ | curl -s -X GET https://identity.api.cloud.hostnet.lv/v3/auth/catalog \ | ||
-H "X-Auth-Token: $OS_TOKEN" | python -m json.tool | -H "X-Auth-Token: $OS_TOKEN" | python -m json.tool | ||
| + | </syntaxhighlight> | ||
| + | Or take endpoint URL from [[Hostnet_OpenStack_Cloud_API_Endpoints|Hostnet OpenStack Cloud API Endpoints]] | ||
| + | |||
| + | <syntaxhighlight lang=bash> | ||
# Set env variable for public compute, image and network endpoints: | # Set env variable for public compute, image and network endpoints: | ||
export VOL_ENDPOINT="{volumeURL}" | export VOL_ENDPOINT="{volumeURL}" | ||
| 102. rindiņa: | 106. rindiņa: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| − | Cinder API: https://developer.openstack.org/api-ref/block-storage/v3/ | + | # Cinder API: https://developer.openstack.org/api-ref/block-storage/v3/ |
| − | Cinder Python client: https://github.com/openstack/python-cinderclient | + | # Cinder Python client: https://github.com/openstack/python-cinderclient |
[[Category:Hostnet OpenStack Cloud]] | [[Category:Hostnet OpenStack Cloud]] | ||
Pašreizējā versija, 2017. gada 6. jūnijs, plkst. 15.04
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
- From the resulting, set environment variable as X-Subject-Token value:
export OS_TOKEN="{X-Subject-Token}"
- 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
Or take endpoint URL from Hostnet OpenStack Cloud API Endpoints
# 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.
- 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"
}
}
- Cinder API: https://developer.openstack.org/api-ref/block-storage/v3/
- Cinder Python client: https://github.com/openstack/python-cinderclient