Query Bare Metal Instance

GET/zstack/v1/baremetal/instances
GET/zstack/v1/baremetal/instances/{uuid}

Headers

Authorization: OAuth the-session-uuid

Curl Example

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/baremetal/instances?q=uuid = 93c50425e0ed3b2884027db70620db38
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/baremetal/instances/f52fb05bdd0837bdbc28dd08a529526c

Queriable Fields

Run the CLI command, enter QueryBaremetalInstance and press Tab to view all queriable fields and resource names that can be queried across tables.

API Response

Response Example

{
  "inventories": [
    {
      "uuid": "9d3a2dd0d48c3220a40a66a33874f25a",
      "name": "BM-1",
      "description": "This is a baremetal instance.",
      "zoneUuid": "4d1bf4f2ab113292808be87ad9ff553b",
      "clusterUuid": "e24ee969ccc83aa287713ec2dca4e8e0",
      "chassisUuid": "da16af4bb6c43b8fba2b5ba918e0cdbb",
      "imageUuid": "70ff9f3ae5863fcfab60999afdf55219",
      "platform": "Linux",
      "state": "Running",
      "status": "Provisioned",
      "createDate": "Nov 14, 2017 2:20:57 PM",
      "lastOpDate": "Nov 14, 2017 2:20:57 PM",
      "bmNics": [
        {
          "uuid": "8fb718abb0bd3ce99215d446cd6dba1d",
          "baremetalInstanceUuid": "9d3a2dd0d48c3220a40a66a33874f25a",
          "l3NetworkUuid": "8b40c2c7a19e3c96b4bca63b56909898",
          "mac": "6c:b3:11:1b:0b:1e",
          "ip": "192.168.0.10",
          "netmask": "255.255.255.0",
          "gateway": "192.168.0.1",
          "pxe": false
        }
      ]
    }
  ]
}
NameTypeDescriptionStarting Version
successboolean 0.6
errorErrorCodeError code. If not null, the operation failed. When the operation is successful, this field is null. For details, see error2.6.0
inventoriesListFor details, see inventories2.6.0

error

NameTypeDescriptionStarting Version
codeStringError code number, globally unique identifier of the error, for example SYS.1000, HOST.10010.6
descriptionStringBrief description of the error0.6
detailsStringDetailed error information0.6
elaborationStringReserved field, default is null0.6
opaqueLinkedHashMapReserved field, default is null0.6
causeErrorCodeRoot cause: the source error that triggered the current error. If there is no original error, this field is null0.6

inventories

NameTypeDescriptionStarting Version
uuidStringUUID of the resource, uniquely identifying the resource2.6.0
nameStringResource name2.6.0
descriptionStringDetailed description of the resource2.6.0
zoneUuidStringData Center UUID2.6.0
clusterUuidStringCluster UUID2.6.0
pxeServerUuidString 3.1.1
chassisUuidStringBare metal chassis UUID2.6.0
imageUuidStringImage UUID2.6.0
platformStringSystem platform2.6.0
stateString 2.6.0
statusString 2.6.0
createDateTimestampCreate time2.6.0
lastOpDateTimestampLast modification time2.6.0
bmNicsListFor details, see bmNics2.6.0

bmNics

NameTypeDescriptionStarting Version
uuidStringUUID of the resource, uniquely identifying the resource2.6.0
baremetalInstanceUuidStringBare metal instance UUID2.6.0
l3NetworkUuidStringDistributed Port Group UUID2.6.0
baremetalBondingUuidStringBOND UUID3.4.0
macStringNetwork card MAC address2.6.0
ipStringIP address2.6.0
netmaskStringSubnet mask2.6.0
gatewayStringGateway2.6.0
metadataString 2.6.0
pxeBooleanWhether this is a PXE boot NIC2.6.0
createDateTimestampCreate time2.6.0
lastOpDateTimestampLast modification time2.6.0

SDK Examples

Java SDK

QueryBaremetalInstanceAction action = new QueryBaremetalInstanceAction();
action.conditions = asList("uuid = 7fac9998fb703185a8b6655af59d0d21");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryBaremetalInstanceAction.Result res = action.call();

Python SDK

action = QueryBaremetalInstanceAction()
action.conditions = ["uuid = a52323ca9c6132eeb0dc607570fb988f"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()