1.1. Get Started¶
Dedicated Hypervisor API allows you to purchase and control your Dedicated Hypervisor servers. Here you can see how to use the API to for some basic usecases.
Create Server¶
First of all, you might need to know how to purchase your Dedicated Hypervisor server. You can follow these steps to buy your first Dedicated Hypervisor server.
Prerequisites¶
1. Authentication¶
At first, please call the authentication API. you can get authentication token, endpoint uris, tenant ID for Baremetal API and Image Data Storage API from GUI page.
In following steps, you need to put the authentication token in X-Auth-Token header of API request.
2. List flavors¶
$ curl -s -X GET {baremetal_server_api_endpoint}/v2/{tenant_id}/flavors \
-H "Content-Type: application/json" \
-H "X-Auth-Token: {token}"
Sample Response¶
{
"flavors": [
{
"id": "05184ba3-00ba-4fbc-b7a2-03b62b884931",
"links": [
{
"href": "https://baremetal-server-jp1-ecl.api.ntt.com/v2/5a077efd3e8e4319be283b22c0ce8c77/flavors/05184ba3-00ba-4fbc-b7a2-03b62b884931",
"rel": "self"
},
{
"href": "https://baremetal-server-jp1-ecl.api.ntt.com/5a077efd3e8e4319be283b22c0ce8c77/flavors/05184ba3-00ba-4fbc-b7a2-03b62b884931",
"rel": "bookmark"
}
],
"name": "General Purpose 1"
},
{
"id": "70a599e031e749b7b260868f441e862b",
"links": [
{
"href": "https://baremetal-server-jp1-ecl.api.ntt.com/v2/5a077efd3e8e4319be283b22c0ce8c77/flavors/70a599e0-31e7-49b7-b260-868f441e862b",
"rel": "yourself"
},
{
"href": "https://baremetal-server-jp1-ecl.api.ntt.com/v2/5a077efd3e8e4319be283b22c0ce8c77/flavors/70a599e0-31e7-49b7-b260-868f441e862b",
"rel": "sample"
}
],
"name": "General Purpose 2"
}
]
}
3. Create server¶
You can create a new Dedicated Hypervisor server with this API call.
$ curl -s -X POST {api_endpoint}/v1.0/{tenant_id}/servers \
-H "Content-Type: application/json" \
-H "X-Auth-Token: {token}"
This will return an ID of the server. You need to specify these parameters you got in the previous steps when calling this API.
- Network information which your new server will be connected to. If it is specified greater than two, default gateway is first network. You can check parameters to connect by Network - List API. If you want how to know setting network information, please refer Network API.
- uuid, Network ID(Required if you omit the Port ID)
- port, Port ID(Required if you omit the Network ID)
- plane, Plane type(optional, ‘storage’ or ‘data’)
- Flavor ID
- Image ID
If you know more detail API information, please refer Create Server.
Sample Request¶
right request body (uuid and segmentation_id is the same for the plane)
{
"server": {
"name": "test-01",
"imageRef": "5f2aa257-38c2-4970-b4c3-dacdbff9fdef",
"flavorRef": "303b4993-cf29-4301-abd0-99512b5413a5",
"adminPass": "password",
"networks": [
{
"uuid": "06c95ff9-0fc8-474b-97e3-9081dee8145d",
"segmentation_id": 3000,
"plane": "data"
},
{
"uuid": "06c95ff9-0fc8-474b-97e3-9081dee8145d",
"segmentation_id": 3000,
"plane": "data"
}
],
"description": "test_server_01",
"metadata": {
"hoge": "fuga"
}
}
}
wrong one (segmentation_id is different)
{
"server": {
"name": "test-01",
"imageRef": "5f2aa257-38c2-4970-b4c3-dacdbff9fdef",
"flavorRef": "303b4993-cf29-4301-abd0-99512b5413a5",
"adminPass": "password",
"networks": [
{
"uuid": "06c95ff9-0fc8-474b-97e3-9081dee8145d",
"segmentation_id": 3000,
"plane": "data"
},
{
"uuid": "06c95ff9-0fc8-474b-97e3-9081dee8145d",
"segmentation_id": 3100, # different
"plane": "data"
}
],
"description": "test_server_01",
"metadata": {
"hoge": "fuga"
}
}
}
you can alse use port parameter.
{
"server": {
"name": "test-01",
"imageRef": "5f2aa257-38c2-4970-b4c3-dacdbff9fdef",
"flavorRef": "303b4993-cf29-4301-abd0-99512b5413a5",
"adminPass": "password",
"networks": [
{
"port": "b7637a2a-7bbc-4350-a622-d67f68fa50fa"
"plane": "data"
},
{
"port": "f25c1942-db77-45d5-9cc3-6109e60d8802",
"plane": "data"
}
],
"description": "test_server_01",
"metadata": {
"hoge": "fuga"
}
}
}