Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com> Co-authored-by: Lai, Weijian <laiweijian4@huawei.com> Co-committed-by: Lai, Weijian <laiweijian4@huawei.com>
33 KiB
Obtaining Nodes
Function
This API is used to obtain nodes in a resource pool.
Debugging
You can debug this API through automatic authentication in or use the SDK sample code generated by API Explorer.
URI
GET /v2/{project_id}/pools/{pool_name}/nodes
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
project_id |
Yes |
String |
Project ID. For details, see Obtaining a Project ID and Name. |
pool_name |
Yes |
String |
Name of a resource pool. |
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
continue |
No |
String |
Previous query location in pagination query. |
limit |
No |
Integer |
Number of records returned for a single pagination query. |
Request Parameters
None
Response Parameters
Status code: 200
Parameter |
Type |
Description |
|---|---|---|
apiVersion |
String |
API version. Options: |
kind |
String |
Resource type. Options: |
metadata |
NodeListMetadata object |
Metadata of resources. |
items |
Array of Node objects |
Nodes. |
Parameter |
Type |
Description |
|---|---|---|
continue |
String |
Next query position during pagination query. |
remainingItemCount |
Long |
Number of remaining resources. |
Parameter |
Type |
Description |
|---|---|---|
apiVersion |
String |
API version. Options: |
kind |
String |
Resource type. Options: |
metadata |
metadata object |
Specifies the node metadata information. |
spec |
NodeSpec object |
Expected node information. |
status |
NodeStatus object |
Node status. |
Parameter |
Type |
Description |
|---|---|---|
name |
String |
Node name. |
creationTimestamp |
String |
Creation time. |
Parameter |
Type |
Description |
|---|---|---|
phase |
String |
Current status of a node. The options are as follows: |
az |
String |
AZ that the node belongs to. |
privateIp |
String |
Node IP address |
resources |
NodeResource object |
Node resource information. |
availableResources |
NodeResource object |
Available resources of a node. |
Parameter |
Type |
Description |
|---|---|---|
cpu |
String |
Number of CPU resources. |
memory |
String |
Indicates the amount of memory resources. |
nvidia.com/gpu |
String |
Number of GPU resources on a GPU node. |
Status code: 404
Parameter |
Type |
Description |
|---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error message. |
Example Requests
Obtain nodes in a resource pool.
GET https://{endpoint}/v2/{project_id}/pools/{pool_name}/nodes
{ }
Example Responses
Status code: 200
OK
{
"kind" : "NodeList",
"apiVersion" : "v2",
"metadata" : { },
"items" : [ {
"kind" : "Node",
"apiVersion" : "v2",
"metadata" : {
"name" : "os-node-created-zlncn",
"creationTimestamp" : "2022-09-16T05:32:44Z"
},
"spec" : {
"flavor" : "modelarts.vm.cpu.4ud"
},
"status" : {
"phase" : "Available",
"az" : "cn-xxxxx-7c",
"privateIp" : "192.168.0.1",
"resources" : {
"cpu" : "3920m",
"memory" : "6270Mi"
},
"availableResources" : {
"cpu" : "2970m",
"memory" : "4558Mi"
}
}
}, {
"kind" : "Node",
"apiVersion" : "v2",
"metadata" : {
"name" : "os-node-created-4s522",
"creationTimestamp" : "2022-09-16T03:20:53Z"
},
"spec" : {
"flavor" : "modelarts.vm.cpu.4ud"
},
"status" : {
"phase" : "Available",
"az" : "cn-xxxxx-7c",
"privateIp" : "192.168.0.2",
"resources" : {
"cpu" : "3920m",
"memory" : "6270Mi"
},
"availableResources" : {
"cpu" : "2970m",
"memory" : "4558Mi"
}
}
}, {
"kind" : "Node",
"apiVersion" : "v2",
"metadata" : {
"name" : "os-node-created-v7hfj",
"creationTimestamp" : "2022-09-16T09:16:37Z"
},
"spec" : {
"flavor" : "modelarts.vm.cpu.4ud"
},
"status" : {
"phase" : "Available",
"az" : "cn-xxxxx-7c",
"privateIp" : "192.168.0.3",
"resources" : {
"cpu" : "3920m",
"memory" : "6270Mi"
},
"availableResources" : {
"cpu" : "3720m",
"memory" : "5670Mi"
}
}
} ]
}
Status code: 404
Not found.
{
"error_code" : "ModelArts.50015001",
"error_msg" : "pool not found"
}
Status Codes
Status Code |
Description |
|---|---|
200 |
OK |
404 |
Not found. |
Error Codes
See Error Codes.