Document navigation

Bare Metal Management (Plus)

The Bare Metal Management feature is provided in a separate module. Before you can use this feature, you need to purchase the Plus License of Bare Metal Management, in addition to the Base License.

Bare Metal Management Operations

CreateBaremetalChassis

API Request

URLs

POST zstack/v1/baremetal/chassis

Headers

Authorization: OAuth the-session-uuid

Body

{
  "params": {
    "name": "test",
    "clusterUuid": "bf598e729e61382ab2486ac40f25c425",
    "ipmiAddress": "1.1.1.1",
    "ipmiPort": "623.0",
    "ipmiUsername": "root",
    "ipmiPassword": "password"
  },
  "systemTags": [],
  "userTags": []
}

In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"name":"test","clusterUuid":"bf598e729e61382ab2486ac40f25c425","ipmiAddress":"1.1.1.1","ipmiPort":"623.0","ipmiUsername":"root","ipmiPassword":"password"}}' http://localhost:8080/zstack/v1/baremetal/chassis

Request Parameters

Name Type Location Description Optional Value Starting Version
name String body (contained in the params structure) The name of the bare metal chassis. 2.6.0
description String body (contained in the params structure) Optional. The detailed description of the bare metal chassis. 2.6.0
clusterUuid String body (contained in the params structure) The UUID of the cluster where the bare metal chassis resides. 2.6.0
ipmiAddress String body (contained in the params structure) The IPMI address of the bare metal chassis. 2.6.0
ipmiPort Integer body (contained in the params structure) Optional. The IPMI port of the bare metal chassis. 2.6.0
ipmiUsername String body (contained in the params structure) The IPMI username. 2.6.0
ipmiPassword String body (contained in the params structure) The IPMI password. 2.6.0
resourceUuid String body (contained in the params structure) The UUID of the bare metal chassis. 2.6.0
systemTags List body Optional. The system tags. 2.6.0
userTags List body Optional. The user tags. 2.6.0

API Response

Sample Response

{
  "inventory": {
    "uuid": "40fae70b4c573bdfad57d031eaba0eb0",
    "ipmiAddress": "1.1.1.1",
    "ipmiPort": 623.0,
    "ipmiUsername": "root",
    "ipmiPassword": "password",
    "state": "Enabled",
    "status": "HWInfoUnknown"
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error 2.6.0
inventory BaremetalChassisInventory See inventory 2.6.0

#error

Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 2.6.0
description String The brief description of the error. 2.6.0
details String The details about the error. 2.6.0
elaboration String The reserved field. Default value: null. 2.6.0
opaque LinkedHashMap The reserved field. Default value: null. 2.6.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 2.6.0

#inventory

Name Type Description Starting Version
uuid String The UUID of the bare metal chassis. 2.6.0
name String The name of the bare metal chassis. 2.6.0
description String The detailed description of the bare metal chassis. 2.6.0
zoneUuid String The zone UUID. 2.6.0
clusterUuid String The cluster UUID. 2.6.0
pxeServerUuid String The pxe server UUID. 3.1.1
ipmiAddress String The IPMI address of the bare metal chassis. 2.6.0
ipmiPort Integer The IPMI port of the bare metal chassis. 2.6.0
ipmiUsername String The IPMI username. 2.6.0
state String The resource state. 2.6.0
status String The resource status. 2.6.0
createDate Timestamp The time when the bare metal chassis was created. 2.6.0
lastOpDate Timestamp The time when the bare metal chassis was last modified. 2.6.0

SDK Sample

Java SDK

CreateBaremetalChassisAction action = new CreateBaremetalChassisAction();
action.name = "test";
action.clusterUuid = "bf598e729e61382ab2486ac40f25c425";
action.ipmiAddress = "1.1.1.1";
action.ipmiPort = "623.0";
action.ipmiUsername = "root";
action.ipmiPassword = "password";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateBaremetalChassisAction.Result res = action.call();

Python SDK

action = CreateBaremetalChassisAction()
action.name = "test"
action.clusterUuid = "bf598e729e61382ab2486ac40f25c425"
action.ipmiAddress = "1.1.1.1"
action.ipmiPort = "623.0"
action.ipmiUsername = "root"
action.ipmiPassword = "password"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

DeleteBaremetalChassis

API Request

URLs

DELETE zstack/v1/baremetal/chassis/{uuid}

Headers

Authorization: OAuth the-session-uuid

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/baremetal/chassis/b4962c6429d23e93b9473f5aee202496

Request Parameters

Name Type Location Description Optional Value Starting Version
uuid String url The UUID of the bare metal chassis. 2.6.0
deleteMode String body Optional. The mode under which the bare metal chassis is deleted. 2.6.0
systemTags List body Optional. The system tags. 2.6.0
userTags List body Optional. The user tags. 2.6.0

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,

{
"error": {
    "code": "SYS.1001",
    "description": "A message or a operation timeout",
    "details": "Create VM on KVM timeout after 300s"
}
}

SDK Sample

Java SDK

DeleteBaremetalChassisAction action = new DeleteBaremetalChassisAction();
action.uuid = "b4962c6429d23e93b9473f5aee202496";
action.deleteMode = "Permissive";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeleteBaremetalChassisAction.Result res = action.call();

Python SDK

action = DeleteBaremetalChassisAction()
action.uuid = "b4962c6429d23e93b9473f5aee202496"
action.deleteMode = "Permissive"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

UpdateBaremetalChassis

API Request

URLs

PUT zstack/v1/baremetal/chassis/{uuid}/actions

Headers

Authorization: OAuth the-session-uuid

Body

{
  "updateBaremetalChassis": {
    "name": "test",
    "ipmiAddress": "1.1.1.1",
    "ipmiPort": "623.0",
    "ipmiUsername": "root",
    "ipmiPassword": "password"
  },
  "systemTags": [],
  "userTags": []
}

In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateBaremetalChassis":{"name":"test","ipmiAddress":"1.1.1.1","ipmiPort":"623.0","ipmiUsername":"root","ipmiPassword":"password"}}' \
http://localhost:8080/zstack/v1/baremetal/chassis/cd68e7a048d831768c622a18accd5885/actions

Request Parameters

Name Type Location Description Optional Value Starting Version
uuid String url The UUID of the bare metal chassis. 2.6.0
name String body (contained in the updateBaremetalChassis structure) Optional. The name of the bare metal chassis. 2.6.0
description String body (contained in the updateBaremetalChassis structure) Optional. The detailed description of the bare metal chassis. 2.6.0
ipmiAddress String body (contained in the updateBaremetalChassis structure) Optional. The IPMI address of the bare metal chassis. 2.6.0
ipmiPort Integer body (contained in the updateBaremetalChassis structure) Optional. The IPMI port of the bare metal chassis. 2.6.0
ipmiUsername String body (contained in the updateBaremetalChassis structure) Optional. The IPMI username. 2.6.0
ipmiPassword String body (contained in the updateBaremetalChassis structure) Optional. The IPMI password. 2.6.0
systemTags List body Optional. The system tags. 2.6.0
userTags List body Optional. The user tags. 2.6.0

API Response

Sample Response

{
  "inventory": {
    "uuid": "2a0f218999633ee9a79fe655206b8671",
    "ipmiAddress": "1.1.1.1",
    "ipmiPort": "623.0",
    "ipmiUsername": "root",
    "ipmiPassword": "password",
    "state": "Enabled",
    "status": "Available"
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error 2.6.0
inventory BaremetalChassisInventory See inventory 2.6.0

#error

Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 2.6.0
description String The brief description of the error. 2.6.0
details String The details about the error. 2.6.0
elaboration String The reserved field. Default value: null. 2.6.0
opaque LinkedHashMap The reserved field. Default value: null. 2.6.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 2.6.0

#inventory

Name Type Description Starting Version
uuid String The UUID of the bare metal chassis. 2.6.0
name String The name of the bare metal chassis. 2.6.0
description String The detailed description of the bare metal chassis. 2.6.0
zoneUuid String The zone UUID. 2.6.0
clusterUuid String The cluster UUID. 2.6.0
pxeServerUuid String The pxe server UUID. 3.1.1
ipmiAddress String The IPMI address of the bare metal chassis. 2.6.0
ipmiPort Integer The IPMI port of the bare metal chassis. 2.6.0
ipmiUsername String The IPMI username. 2.6.0
state String The resource state. 2.6.0
status String The resource status. 2.6.0
createDate Timestamp The time when the bare metal chassis was created. 2.6.0
lastOpDate Timestamp The time when the bare metal chassis was last modified. 2.6.0

SDK Sample

Java SDK

UpdateBaremetalChassisAction action = new UpdateBaremetalChassisAction();
action.uuid = "cd68e7a048d831768c622a18accd5885";
action.name = "test";
action.ipmiAddress = "1.1.1.1";
action.ipmiPort = "623.0";
action.ipmiUsername = "root";
action.ipmiPassword = "password";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateBaremetalChassisAction.Result res = action.call();

Python SDK

action = UpdateBaremetalChassisAction()
action.uuid = "cd68e7a048d831768c622a18accd5885"
action.name = "test"
action.ipmiAddress = "1.1.1.1"
action.ipmiPort = "623.0"
action.ipmiUsername = "root"
action.ipmiPassword = "password"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

QueryBaremetalChassis

API Request

URLs

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

Headers

Authorization: OAuth the-session-uuid

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/baremetal/chassis?q=uuid=fcdbdc973fe138d991cb9e4c0c96bf24
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/baremetal/chassis/74db6aa9f4593fddbe914d86510e9244

Queryable Fields

You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QueryBaremetalChassis, and pressing the Tab key.

API Response

Sample Response

{
  "inventories": [
    {
      "uuid": "adf78dd20777349f8b1a9f31b5b1de71",
      "ipmiAddress": "1.1.1.1",
      "ipmiPort": "623.0",
      "ipmiUsername": "root",
      "ipmiPassword": "password",
      "state": "Enabled",
      "status": "Available"
    }
  ]
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error 2.6.0
inventories List See inventories 2.6.0

#error

Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 2.6.0
description String The brief description of the error. 2.6.0
details String The details about the error. 2.6.0
elaboration String The reserved field. Default value: null. 2.6.0
opaque LinkedHashMap The reserved field. Default value: null. 2.6.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 2.6.0

#inventories

Name Type Description Starting Version
uuid String The UUID of the bare metal chassis. 2.6.0
name String The name of the bare metal chassis. 2.6.0
description String The detailed description of the bare metal chassis. 2.6.0
zoneUuid String The zone UUID. 2.6.0
clusterUuid String The cluster UUID. 2.6.0
pxeServerUuid String The pxe server UUID. 3.1.1
ipmiAddress String The IPMI address of the bare metal chassis. 2.6.0
ipmiPort Integer The IPMI port of the bare metal chassis. 2.6.0
ipmiUsername String The IPMI username. 2.6.0
state String The resource state. 2.6.0
status String The resource status. 2.6.0
createDate Timestamp The time when the bare metal chassis was created. 2.6.0
lastOpDate Timestamp The time when the bare metal chassis was last modified. 2.6.0

SDK Sample

Java SDK

QueryBaremetalChassisAction action = new QueryBaremetalChassisAction();
action.conditions = asList("uuid=79aa822340b2328793e624e0416cc55a");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryBaremetalChassisAction.Result res = action.call();

Python SDK

action = QueryBaremetalChassisAction()
action.conditions = ["uuid=41375a72ff0d381fac8f50f5b8e7a27f"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

BatchCreateBaremetalChassis

API Request

URLs

POST zstack/v1/baremetal/chassis/from-file

Headers

Authorization: OAuth the-session-uuid

Body

{
  "params": {
    "baremetalChassisInfo": "FILE CONTENT ENCODE BY BASE64"
  },
  "systemTags": [],
  "userTags": []
}

In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"baremetalChassisInfo":"FILE CONTENT ENCODE BY BASE64"}}' http://localhost:8080/zstack/v1/baremetal/chassis/from-file

Request Parameters

Name Type Location Description Optional Value Starting Version
baremetalChassisInfo String body (contained in the params structure) The Base64-encoded configuration file of bare metal chassis. 3.1.1
longJobName String body (contained in the params structure) Optional. The name of the long job. 3.1.1
longJobDescription String body (contained in the params structure) Optional. The description of the long job. 3.1.1
resourceUuid String body (contained in the params structure) Optional. The UUID of the long job. 3.1.1
systemTags List body Optional. The system tags. 3.1.1
userTags List body Optional. The user tags. 3.1.1

API Response

Sample Response

{
  "inventory": {
    "uuid": "cec9662c5cc534779833c89d8104aa7d",
    "name": "APIBatchCreateBaremetalChassisMsg",
    "apiId": "85ef8b327b0a3c71a53827b30892f327",
    "jobName": "APIBatchCreateBaremetalChassisMsg",
    "jobData": "{\"createMessages\":[]",
    "jobResult": "",
    "state": "Succeeded",
    "managementNodeUuid": "31c1228477b6310b9eb28a75e892b046"
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error 3.1.1
inventory LongJobInventory See inventory 3.1.1

#error

Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.1.1
description String The brief description of the error. 3.1.1
details String The details about the error. 3.1.1
elaboration String The reserved field. Default value: null. 3.1.1
opaque LinkedHashMap The reserved field. Default value: null. 3.1.1
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.1.1

#inventory

Name Type Description Starting Version
uuid String The UUID of the API request. 3.1.1
name String The name of the API. 3.1.1
description String The detailed description of the long job. 3.1.1
apiId String The ID of the long job. 3.1.1
jobName String The name of the long job. 3.1.1
jobData String The data about the long job. 3.1.1
jobResult String The result of the long job. 3.1.1
targetResourceUuid String The UUID of the long job. 3.1.1
managementNodeUuid String The UUID of the management node. 3.1.1
createDate Timestamp The time when the long job was created. 3.1.1
lastOpDate Timestamp The time when the long job was last operated. 3.1.1
state LongJobState See state 3.1.1

#state

Name Type Description Starting Version
name String The name of the long job. 3.1.1
ordinal int The ordinal number. 3.1.1

SDK Sample

Java SDK

BatchCreateBaremetalChassisAction action = new BatchCreateBaremetalChassisAction();
action.baremetalChassisInfo = "FILE CONTENT ENCODE BY BASE64";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
BatchCreateBaremetalChassisAction.Result res = action.call();

Python SDK

action = BatchCreateBaremetalChassisAction()
action.baremetalChassisInfo = "FILE CONTENT ENCODE BY BASE64"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

CheckBaremetalChassisConfigFile

API Request

URLs

POST /v1/baremetal/chassis/from-file/check

Headers

Authorization: OAuth the-session-uuid

Body

{
  "params": {
    "baremetalChassisInfo": "FILE CONTENT ENCODE BY BASE64"
  },
  "systemTags": [],
  "userTags": []
}

In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"baremetalChassisInfo":"FILE CONTENT ENCODE BY BASE64"}}' http://localhost:8080/zstack/v1/baremetal/chassis/from-file/check

Request Parameters

Name Type Location Description Optional Value Starting Version
baremetalChassisInfo String body (contained in the params structure) The base64-encoded configuration file of bare metal chassis. 3.1.1
systemTags List body Optional. The system tags. 3.1.1
userTags List body Optional. The user tags. 3.1.1

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,

{
"error": {
    "code": "SYS.1001",
    "description": "A message or a operation timeout",
    "details": "Create VM on KVM timeout after 300s"
}
}

SDK Sample

Java SDK

CheckBaremetalChassisConfigFileAction action = new CheckBaremetalChassisConfigFileAction();
action.baremetalChassisInfo = "FILE CONTENT ENCODE BY BASE64";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CheckBaremetalChassisConfigFileAction.Result res = action.call();

Python SDK

action = CheckBaremetalChassisConfigFileAction()
action.baremetalChassisInfo = "FILE CONTENT ENCODE BY BASE64"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

PowerOnBaremetalChassis

API Request

URLs

PUT zstack/v1/baremetal/chassis/{chassisUuid}/actions

Headers

Authorization: OAuth the-session-uuid

Body

{
  "powerOnBaremetalChassis": {},
  "systemTags": [],
  "userTags": []
  }

In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"powerOnBaremetalChassis":{}}' http://localhost:8080/zstack/v1/baremetal/chassis/7405d7ceb46634528618789cde730795/actions

Request Parameters

Name Type Location Description Optional Value Starting Version
chassisUuid String url The UUID of the bare metal chassis. 2.6.0
systemTags List body Optional. The system tags. 2.6.0
userTags List body Optional. The user tags. 2.6.0

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,

{
"error": {
    "code": "SYS.1001",
    "description": "A message or a operation timeout",
    "details": "Create VM on KVM timeout after 300s"
}
}

SDK Sample

Java SDK

PowerOnBaremetalChassisAction action = new PowerOnBaremetalChassisAction();
action.chassisUuid = "7405d7ceb46634528618789cde730795";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
PowerOnBaremetalChassisAction.Result res = action.call();

Python SDK

action = PowerOnBaremetalChassisAction()
action.chassisUuid = "7405d7ceb46634528618789cde730795"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

PowerOffBaremetalChassis

API Request

URLs

PUT zstack/v1/baremetal/chassis/{chassisUuid}/actions

Headers

Authorization: OAuth the-session-uuid

Body

{
  "powerOffBaremetalChassis": {},
  "systemTags": [],
  "userTags": []
}

In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"powerOffBaremetalChassis":{}}' http://localhost:8080/zstack/v1/baremetal/chassis/ee53c6d1f4ad3ebb8971aa5933d6f9d6/actions

Request Parameters

Name Type Location Description Optional Value Starting Version
chassisUuid String url The UUID of the bare metal chassis. 2.6.0
systemTags List body Optional. The system tags. 2.6.0
userTags List body Optional. The user tags. 2.6.0

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,

{
"error": {
    "code": "SYS.1001",
    "description": "A message or a operation timeout",
    "details": "Create VM on KVM timeout after 300s"
}
}

SDK Sample

Java SDK

PowerOffBaremetalChassisAction action = new PowerOffBaremetalChassisAction();
action.chassisUuid = "ee53c6d1f4ad3ebb8971aa5933d6f9d6";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
PowerOffBaremetalChassisAction.Result res = action.call();

Python SDK

action = PowerOffBaremetalChassisAction()
action.chassisUuid = "ee53c6d1f4ad3ebb8971aa5933d6f9d6"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

PowerResetBaremetalChassis

API Request

URLs

PUT zstack/v1/baremetal/chassis/{chassisUuid}/actions

Headers

Authorization: OAuth the-session-uuid

Body

{
  "powerResetBaremetalChassis": {},
  "systemTags": [],
  "userTags": []
}

In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"powerResetBaremetalChassis":{}}' http://localhost:8080/zstack/v1/baremetal/chassis/8a947fc86c0c3e1d89462722af254ddf/actions

Request Parameters

Name Type Location Description Optional Value Starting Version
chassisUuid String url The UUID of the bare metal chassis. 2.6.0
systemTags List body Optional. The system tags. 2.6.0
userTags List body Optional. The user tags. 2.6.0

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,

{
"error": {
    "code": "SYS.1001",
    "description": "A message or a operation timeout",
    "details": "Create VM on KVM timeout after 300s"
}
}

SDK Sample

Java SDK

PowerResetBaremetalChassisAction action = new PowerResetBaremetalChassisAction();
action.chassisUuid = "8a947fc86c0c3e1d89462722af254ddf";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
PowerResetBaremetalChassisAction.Result res = action.call();

Python SDK

action = PowerResetBaremetalChassisAction()
action.chassisUuid = "8a947fc86c0c3e1d89462722af254ddf"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

GetBaremetalChassisPowerStatus

API Request

URLs

GET zstack/v1/baremetal/chassis/{uuid}/powerstatus

Headers

Authorization: OAuth the-session-uuid

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/baremetal/chassis/1fcf1caf5dae30f08ff995620a5bdffd/powerstatus

Request Parameters

Name Type Location Description Optional Value Starting Version
uuid String url The UUID of the bare metal chassis. 2.6.0
systemTags List query Optional. The system tags. 2.6.0
userTags List query Optional. The user tags. 2.6.0

API Response

Sample Response

{
  "status": "ON"
}
Name Type Description Starting Version
status String The power status of the bare metal chassis. 2.6.0
success boolean Whether the operation succeeded. 2.6.0
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error 2.6.0
error ErrorCode See error 2.6.0

#error

Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 2.6.0
description String The brief description of the error. 2.6.0
details String The details about the error. 2.6.0
elaboration String The reserved field. Default value: null. 2.6.0
opaque LinkedHashMap The reserved field. Default value: null. 2.6.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 2.6.0

#error

Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 2.6.0
description String The brief description of the error. 2.6.0
details String The details about the error. 2.6.0
elaboration String The reserved field. Default value: null. 2.6.0
opaque LinkedHashMap The reserved field. Default value: null. 2.6.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 2.6.0

SDK Sample

Java SDK

GetBaremetalChassisPowerStatusAction action = new GetBaremetalChassisPowerStatusAction();
action.uuid = "1fcf1caf5dae30f08ff995620a5bdffd";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetBaremetalChassisPowerStatusAction.Result res = action.call();

Python SDK

action = GetBaremetalChassisPowerStatusAction()
action.uuid = "1fcf1caf5dae30f08ff995620a5bdffd"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

ChangeBaremetalChassisState

API Request

URLs

PUT zstack/v1/baremetal/chassis/{uuid}/actions

Headers

Authorization: OAuth the-session-uuid

Body

{
  "changeBaremetalChassisState": {
    "stateEvent": "enable"
  },
  "systemTags": [],
  "userTags": []
}

In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"changeBaremetalChassisState":{"stateEvent":"enable"}}' http://localhost:8080/zstack/v1/baremetal/chassis/1a600f11b61e3585bbd26d06166ff640/actions

Request Parameters

Name Type Location Description Optional Value Starting Version
uuid String url The UUID of the bare metal chassis. 2.6.0
stateEvent String body (contained in the changeBaremetalChassisState structure) The action taken to change the status of the bare metal chassis.
  • enable
  • disable
2.6.0
systemTags List body Optional. The system tags. 2.6.0
userTags List body Optional. The user tags. 2.6.0

API Response

Sample Response

{
  "inventory": {
    "uuid": "506008545fa7391cb2586ae7d6180696",
    "ipmiAddress": "1.1.1.1",
    "ipmiPort": 623.0,
    "ipmiUsername": "root",
    "ipmiPassword": "password",
    "state": "Enabled",
    "status": "Available"
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error 2.6.0
inventory BaremetalChassisInventory See inventory 2.6.0

#error

Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 2.6.0
description String The brief description of the error. 2.6.0
details String The details about the error. 2.6.0
elaboration String The reserved field. Default value: null. 2.6.0
opaque LinkedHashMap The reserved field. Default value: null. 2.6.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 2.6.0

#inventory

Name Type Description Starting Version
uuid String The UUID of the bare metal chassis. 2.6.0
name String The name of the bare metal chassis. 2.6.0
description String The detailed description of the bare metal chassis. 2.6.0
zoneUuid String The zone UUID. 2.6.0
clusterUuid String The cluster UUID. 2.6.0
pxeServerUuid String The pxe server UUID. 3.1.1
ipmiAddress String The IPMI address of the bare metal chassis. 2.6.0
ipmiPort Integer The IPMI port of the bare metal chassis. 2.6.0
ipmiUsername String The IPMI username. 2.6.0
state String The resource state. 2.6.0
status String The resource status. 2.6.0
createDate Timestamp The time when the bare metal chassis was created. 2.6.0
lastOpDate Timestamp The time when the bare metal chassis was last modified. 2.6.0

SDK Sample

Java SDK

ChangeBaremetalChassisStateAction action = new ChangeBaremetalChassisStateAction();
action.uuid = "1a600f11b61e3585bbd26d06166ff640";
action.stateEvent = "enable";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
ChangeBaremetalChassisStateAction.Result res = action.call();

Python SDK

action = ChangeBaremetalChassisStateAction()
action.uuid = "1a600f11b61e3585bbd26d06166ff640"
action.stateEvent = "enable"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

InspectBaremetalChassis

API Request

URLs

PUT zstack/v1/baremetal/chassis/{uuid}/actions

Headers

Authorization: OAuth the-session-uuid

Body

{
  "inspectBaremetalChassis": {},
  "systemTags": [],
  "userTags": []
}

In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"inspectBaremetalChassis":{}}' http://localhost:8080/zstack/v1/baremetal/chassis/514c293bdd6c3bc38f0dd5050f85642d/actions

Request Parameters

Name Type Location Description Optional Value Starting Version
uuid String url The UUID of the bare metal chassis. 2.6.0
systemTags List body Optional. The system tags. 2.6.0
userTags List body Optional. The user tags. 2.6.0

API Response

Sample Response

{
  "inventory": {
    "uuid": "a4871bb97ab03c818419484564fadbfb",
    "ipmiAddress": "1.1.1.1",
    "ipmiPort": 623.0,
    "ipmiUsername": "root",
    "ipmiPassword": "password",
    "state": "Enabled",
    "status": "PxeBooting"
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error 2.6.0
inventory BaremetalChassisInventory See inventory 2.6.0

#error

Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 2.6.0
description String The brief description of the error. 2.6.0
details String The details about the error. 2.6.0
elaboration String The reserved field. Default value: null. 2.6.0
opaque LinkedHashMap The reserved field. Default value: null. 2.6.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 2.6.0

#inventory

Name Type Description Starting Version
uuid String The UUID of the bare metal chassis. 2.6.0
name String The name of the bare metal chassis. 2.6.0
description String The detailed description of the bare metal chassis. 2.6.0
zoneUuid String The zone UUID. 2.6.0
clusterUuid String The cluster UUID. 2.6.0
pxeServerUuid String The pxe server UUID. 3.1.1
ipmiAddress String The IPMI address of the bare metal chassis. 2.6.0
ipmiPort Integer The IPMI port of the bare metal chassis. 2.6.0
ipmiUsername String The IPMI username. 2.6.0
state String The resource state. 2.6.0
status String The resource status. 2.6.0
createDate Timestamp The time when the bare metal chassis was created. 2.6.0
lastOpDate Timestamp The time when the bare metal chassis was last modified. 2.6.0

SDK Sample

Java SDK

InspectBaremetalChassisAction action = new InspectBaremetalChassisAction();
action.uuid = "514c293bdd6c3bc38f0dd5050f85642d";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
InspectBaremetalChassisAction.Result res = action.call();

Python SDK

action = InspectBaremetalChassisAction()
action.uuid = "514c293bdd6c3bc38f0dd5050f85642d"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

CreateBaremetalInstance

API Request

URLs

POST zstack/v1/baremetal/instances

Headers

Authorization: OAuth the-session-uuid

Body

{
  "params": {
    "name": "BM-1",
    "description": "This is a baremetal instance.",
    "chassisUuid": "b79a4de35d2b346c96ac0093f2aadef1",
    "imageUuid": "2f4cf15ce5c2345999550bd13195feaf",
    "templateUuid": "7fffea7efdae39968d51ef5686c09365",
    "username": "root",
    "password": "password",
    "nicCfgs": {
      "6c:b3:11:1b:0b:1e": "fa8f784c641a3193bb070b90b2ac9e66",
      "6c:b3:11:1b:0b:1f": "ee081a7ea13e312d8191926076fba22c"
    },
    "bondingCfgs": {
      "120342ecdb913830b88553ba982edb78": "23b04081ead93f4bb6be6443755e46a5"
    },
    "customConfigurations": {
      "keyboard": "en_US",
      "hostname": "localhost"
    },
    "strategy": "InstantStart"
  },
  "systemTags": [],
  "userTags": []
  }

In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"name":"BM-1","description":"This is a baremetal instance.","chassisUuid":"b79a4de35d2b346c96ac0093f2aadef1","imageUuid":"2f4cf15ce5c2345999550bd13195feaf","templateUuid":"7fffea7efdae39968d51ef5686c09365","username":"root","password":"password","nicCfgs":{"6c:b3:11:1b:0b:1e":"fa8f784c641a3193bb070b90b2ac9e66","6c:b3:11:1b:0b:1f":"ee081a7ea13e312d8191926076fba22c"},"bondingCfgs":{"120342ecdb913830b88553ba982edb78":"23b04081ead93f4bb6be6443755e46a5"},"customConfigurations":{"keyboard":"en_US","hostname":"localhost"},"strategy":"InstantStart"}}' http://localhost:8080/zstack/v1/baremetal/instances

Request Parameters

Name Type Location Description Optional Value Starting Version
name String body (contained in the params structure) The name of the bare metal instance. 2.6.0
description String body (contained in the params structure) Optional. The detailed description of the bare metal instance. 2.6.0
chassisUuid String body (contained in the params structure) The UUID of the bare metal chassis. 2.6.0
imageUuid String body (contained in the params structure) The image UUID. 2.6.0
templateUuid String body (contained in the params structure) Optional. The UUID of the preconfigured template. 3.3.0
username String body (contained in the params structure) Optional. The system user of the bare metal instance. 3.3.0
password String body (contained in the params structure) Optional. The password of the bare metal instance. 2.6.0
nicCfgs Map body (contained in the params structure) Optional. The network configurations of the bare metal instance. 2.6.0
bondingCfgs Map body (contained in the params structure) Optional. The network bonding configurations of the bare metal instance. 3.3.0
customConfigurations Map body (contained in the params structure) Optional. The custom configurations of the bare metal instance. 3.3.0
strategy String body (contained in the params structure) Optional. The strategy used to create the bare metal instance.
  • InstantStart
  • JustCreate
2.6.0
resourceUuid String body (contained in the params structure) The resource UUID. If you specify this parameter, the value of this parameter is the UUID of the bare metal instance. 2.6.0
systemTags List body Optional. The system tags. 2.6.0
userTags List body Optional. The user tags. 2.6.0
  • When you create a bare metal instance in ZStack Cloud, you can specify a static IP address for the bare metal instance by adding the staticIp option to SystemTags. The SystemTag is passed by using the staticIp parameter.

  • Format of the staticIp option: staticIp::{%s}::{%s}. Here, the first %s expression is an L3 network UUID while the second %s expression is the specified IP address.

  • Example: staticIp::f00d593dff2e4bd58473388ac411ade2::192.168.0.10.

  • When you create a bare metal instance in ZStack Cloud, you can overwrite the installation of the bare metal instance by adding the forceInstall option to SystemTags. The SystemTag is passed by using the forceInstall parameter.

    • If the forceInstall does not exist, and if a partition is detected in the target disk during the system installation, the installation process will be paused to avoid overwriting the disk data.
    • If the forceInstall exists, and if a partition is detected in the target disk during the system installation, the partition will be automatically cleansed, and the installation will be overwritten.
  • When you create a bare metal instance in ZStack Cloud, you can specify the switch information for by adding the switchInfo option to SystemTags. The SystemTag is passed by using the switchInfo parameter.

  • Format of the switchInfo option: switchInfo::{%s}::{%s}.

  • Example: switchInfo::mac::switchInfo.

API Response

Sample Response

{
  "inventory": {
    "uuid": "1dc13c821a713f7fbfa7dd754f100a73",
    "name": "BM-1",
    "description": "This is a baremetal instance.",
    "zoneUuid": "0f67724b4dc5397ea39751fda57c4ce6",
    "clusterUuid": "7921d51dba31317e8c09d50e44abd010",
    "chassisUuid": "5183b18300e43aa784a643b86a9772b7",
    "imageUuid": "a39b3870f3ae393cadcc3b4cfb454653",
    "platform": "Linux",
    "state": "Created",
    "status": "Unprovisioned",
    "createDate": "Nov 14, 2017 10:20:57 PM",
    "lastOpDate": "Nov 14, 2017 10:20:57 PM",
    "bmNics": [
      {
        "uuid": "006915f4766c32ee8b09bf951dd43264",
        "baremetalInstanceUuid": "1dc13c821a713f7fbfa7dd754f100a73",
        "l3NetworkUuid": "1fa935a68b4e312aa482df27b3b759a5",
        "mac": "6c:b3:11:1b:0b:1e",
        "ip": "192.168.0.10",
        "netmask": "255.255.255.0",
        "gateway": "192.168.0.1",
        "pxe": false
      }
    ]
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error 2.6.0
inventory BaremetalInstanceInventory See inventory 2.6.0

#error

Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 2.6.0
description String The brief description of the error. 2.6.0
details String The details about the error. 2.6.0
elaboration String The reserved field. Default value: null. 2.6.0
opaque LinkedHashMap The reserved field. Default value: null. 2.6.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 2.6.0

#inventory

Name Type Description Starting Version
uuid String The UUID of the bare metal instance. 2.6.0
name String The name of the bare metal instance. 2.6.0
description String The detailed description of the bare metal instance. 2.6.0
zoneUuid String The zone UUID. 2.6.0
clusterUuid String The cluster UUID. 2.6.0
pxeServerUuid String The pxe server UUID. 3.1.1
chassisUuid String The UUID of the bare metal chassis. 2.6.0
imageUuid String The image UUID. 2.6.0
platform String The system platform. 2.6.0
state String The resource state. 2.6.0
status String The resource status. 2.6.0
createDate Timestamp The time when the bare metal instance was created. 2.6.0
lastOpDate Timestamp The time when the bare metal instance was last modified. 2.6.0
bmNics List See bmNics 2.6.0

#bmNics

Name Type Description Starting Version
uuid String The UUID of the NIC of the bare metal instance. 2.6.0
baremetalInstanceUuid String The UUID of the bare metal instance. 2.6.0
l3NetworkUuid String The L3 network UUID. 2.6.0
mac String The MAC address of the bare metal instance. 2.6.0
ip String The IP address of the bare metal instance. 2.6.0
netmask String The netmask of the bare metal instance. 2.6.0
gateway String The gateway of the bare metal instance. 2.6.0
metadata String The metadata. 2.6.0
pxe Boolean Indicates whether the bare metal instance is PXE boot by using its NIC. 2.6.0
createDate Timestamp The time when the bare metal instance was created. 2.6.0
lastOpDate Timestamp The time when the bare metal instance was last modified. 2.6.0

SDK Sample

Java SDK

CreateBaremetalInstanceAction action = new CreateBaremetalInstanceAction();
action.name = "BM-1";
action.description = "This is a baremetal instance.";
action.chassisUuid = "b79a4de35d2b346c96ac0093f2aadef1";
action.imageUuid = "2f4cf15ce5c2345999550bd13195feaf";
action.templateUuid = "7fffea7efdae39968d51ef5686c09365";
action.username = "root";
action.password = "password";
action.nicCfgs = [6c:b3:11:1b:0b:1e:fa8f784c641a3193bb070b90b2ac9e66, 6c:b3:11:1b:0b:1f:ee081a7ea13e312d8191926076fba22c];
action.bondingCfgs = [120342ecdb913830b88553ba982edb78:23b04081ead93f4bb6be6443755e46a5];
action.customConfigurations = [keyboard:en_US, hostname:localhost];
action.strategy = "InstantStart";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateBaremetalInstanceAction.Result res = action.call();

Python SDK

action = CreateBaremetalInstanceAction()
action.name = "BM-1"
action.description = "This is a baremetal instance."
action.chassisUuid = "b79a4de35d2b346c96ac0093f2aadef1"
action.imageUuid = "2f4cf15ce5c2345999550bd13195feaf"
action.templateUuid = "7fffea7efdae39968d51ef5686c09365"
action.username = "root"
action.password = "password"
action.nicCfgs = [6c:b3:11:1b:0b:1e:fa8f784c641a3193bb070b90b2ac9e66, 6c:b3:11:1b:0b:1f:ee081a7ea13e312d8191926076fba22c]
action.bondingCfgs = [120342ecdb913830b88553ba982edb78:23b04081ead93f4bb6be6443755e46a5]
action.customConfigurations = [keyboard:en_US, hostname:localhost]
action.strategy = "InstantStart"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

QueryBaremetalInstance

API Request

URLs

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

Headers

Authorization: OAuth the-session-uuid

Curl Sample

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

Queryable Fields

You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QueryBaremetalInstance, and pressing the Tab key.

API Response

Sample Response

{
  "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 10:20:57 PM",
      "lastOpDate": "Nov 14, 2017 10: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
        }
      ]
    }
  ]
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error 2.6.0
inventories List See inventories 2.6.0

#error

Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 2.6.0
description String The brief description of the error. 2.6.0
details String The details about the error. 2.6.0
elaboration String The reserved field. Default value: null. 2.6.0
opaque LinkedHashMap The reserved field. Default value: null. 2.6.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 2.6.0

#inventories

Name Type Description Starting Version
uuid String The UUID of the bare metal instance. 2.6.0
name String The name of the bare metal instance. 2.6.0
description String The detailed description of the bare metal instance. 2.6.0
zoneUuid String The zone UUID. 2.6.0
clusterUuid String The cluster UUID. 2.6.0
pxeServerUuid String The pxe server UUID. 3.1.1
chassisUuid String The UUID of the bare metal chassis. 2.6.0
imageUuid String The image UUID. 2.6.0
platform String The system platform. 2.6.0
state String The resource state. 2.6.0
status String The resource status. 2.6.0
createDate Timestamp The time when the bare metal instance was created. 2.6.0
lastOpDate Timestamp The time when the bare metal instance was last modified. 2.6.0
bmNics List See bmNics 2.6.0

#bmNics

Name Type Description Starting Version
uuid String The UUID of the NIC of the bare metal instance. 2.6.0
baremetalInstanceUuid String The UUID of the bare metal instance. 2.6.0
l3NetworkUuid String The L3 network UUID. 2.6.0
baremetalBondingUuid String The network bonding UUID. 3.4.0
mac String The MAC address of the bare metal instance. 2.6.0
ip String The IP address of the bare metal instance. 2.6.0
netmask String The netmask of the bare metal instance. 2.6.0
gateway String The gateway of the bare metal instance. 2.6.0
metadata String The metadata. 2.6.0
pxe Boolean Indicates whether the bare metal instance was PXE boot by using its NIC. 2.6.0
createDate Timestamp The time when the bare metal instance was created. 2.6.0
lastOpDate Timestamp The time when the bare metal instance was last modified. 2.6.0

SDK Sample

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()

StartBaremetalInstance

API Request

URLs

PUT zstack/v1/baremetal/instances/{uuid}/actions

Headers

Authorization: OAuth the-session-uuid

Body

{
  "startBaremetalInstance": {
    "pxeBoot": false
  },
  "systemTags": [],
  "userTags": []
}

In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"startBaremetalInstance":{"pxeBoot":false}}' http://localhost:8080/zstack/v1/baremetal/instances/dc6931adfb8a38bf9919d46b1531e9e4/actions

Request Parameters

Name Type Location Description Optional Value Starting Version
uuid String url The UUID of the bare metal instance. 2.6.0
pxeBoot Boolean body (contained in the startBaremetalInstance structure) Optional. Specifies whether to PXE boot the bare metal instance by using its NIC. 2.6.0
systemTags List body Optional. The system tags. 2.6.0
userTags List body Optional. The user tags. 2.6.0

API Response

Sample Response

{
  "inventory": {
    "uuid": "0be601277df73fa7bdb114b9ece8aec3",
    "name": "BM-1",
    "description": "This is a baremetal instance.",
    "zoneUuid": "9b4745853c913a549499e39c2f8db6c7",
    "clusterUuid": "21f709c6a9783fcb80803dece29a712a",
    "chassisUuid": "4c3e24bc9218382c83ff81e9205fdc47",
    "imageUuid": "e425f9323a4e3463b3a308c5ecca6653",
    "platform": "Linux",
    "state": "Running",
    "status": "Provisioned",
    "createDate": "Nov 14, 2017 10:20:57 PM",
    "lastOpDate": "Nov 14, 2017 10:20:57 PM",
    "bmNics": [
      {
        "uuid": "de7f5a22aa483de88bb3ede1c7dd071f",
        "baremetalInstanceUuid": "0be601277df73fa7bdb114b9ece8aec3",
        "l3NetworkUuid": "41ebe67163003dec94da84c6c5224037",
        "mac": "6c:b3:11:1b:0b:1e",
        "ip": "192.168.0.10",
        "netmask": "255.255.255.0",
        "gateway": "192.168.0.1",
        "pxe": false
      }
    ]
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error 2.6.0
inventory BaremetalInstanceInventory See inventory 2.6.0

#error

Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 2.6.0
description String The brief description of the error. 2.6.0
details String The details about the error. 2.6.0
elaboration String The reserved field. Default value: null. 2.6.0
opaque LinkedHashMap The reserved field. Default value: null. 2.6.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 2.6.0

#inventory

Name Type Description Starting Version
uuid String The UUID of the bare metal instance. 2.6.0
name String The name of the bare metal instance. 2.6.0
description String The detailed description of the bare metal instance. 2.6.0
zoneUuid String The zone UUID. 2.6.0
clusterUuid String The cluster UUID. 2.6.0
pxeServerUuid String The pxe server UUID. 3.1.1
chassisUuid String The UUID of the bare metal chassis. 2.6.0
imageUuid String The image UUID. 2.6.0
platform String The system platform. 2.6.0
state String The resource state. 2.6.0
status String The resource status. 2.6.0
createDate Timestamp The time when the bare metal instance was created. 2.6.0
lastOpDate Timestamp The time when the bare metal instance was last modified. 2.6.0
bmNics List See bmNics 2.6.0

#bmNics

Name Type Description Starting Version
uuid String The UUID of the NIC of the bare metal instance. 2.6.0
baremetalInstanceUuid String The UUID of the bare metal instance. 2.6.0
l3NetworkUuid String The L3 network UUID. 2.6.0
baremetalBondingUuid String The network bonding UUID. 3.3.0
mac String The MAC address of the bare metal instance. 2.6.0
ip String The IP address of the bare metal instance. 2.6.0
netmask String The netmask of the bare metal instance. 2.6.0
gateway String The gateway of the bare metal instance. 2.6.0
metadata String The metadata. 2.6.0
pxe Boolean Indicates whether the bare metal instance was PXE boot by using its NIC. 2.6.0
createDate Timestamp The time when the bare metal instance was created. 2.6.0
lastOpDate Timestamp The time when the bare metal instance was last modified. 2.6.0

SDK Sample

Java SDK

StartBaremetalInstanceAction action = new StartBaremetalInstanceAction();
action.uuid = "dc6931adfb8a38bf9919d46b1531e9e4";
action.pxeBoot = false;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
StartBaremetalInstanceAction.Result res = action.call();

Python SDK

action = StartBaremetalInstanceAction()
action.uuid = "dc6931adfb8a38bf9919d46b1531e9e4"
action.pxeBoot = false
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

StopBaremetalInstance

API Request

URLs

PUT zstack/v1/baremetal/instances/{uuid}/actions

Headers

Authorization: OAuth the-session-uuid

Body

{
  "stopBaremetalInstance": {
    "type": "grace"
  },
  "systemTags": [],
  "userTags": []
}

In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"stopBaremetalInstance":{"type":"grace"}}' http://localhost:8080/zstack/v1/baremetal/instances/d106a65de4e43667a794a0606a05f724/actions

Request Parameters

Name Type Location Description Optional Value Starting Version
uuid String url The UUID of the bare metal instance. 2.6.0
type String body (contained in the stopBaremetalInstance structure) Optional. The type of stopping the bare metal instance.
  • grace
  • cold
2.6.0
systemTags List body Optional. The system tags. 2.6.0
userTags List body Optional. The user tags. 2.6.0

API Response

Sample Response

{
  "inventory": {
    "uuid": "4bf8e15fe39c3b0d8055b7074a522d2d",
    "name": "BM-1",
    "description": "This is a baremetal instance.",
    "zoneUuid": "541a4429a399336288dcbb83fe2573b4",
    "clusterUuid": "30efc0a59ac53afeb1d4d1fe2226a0a9",
    "chassisUuid": "7bd2492307033fedb5311dd23ddf2bbd",
    "imageUuid": "441390c7c83c3592ac29e6f1e38d392f",
    "platform": "Linux",
    "state": "Stopped",
    "status": "Provisioned",
    "createDate": "Nov 14, 2017 10:20:57 PM",
    "lastOpDate": "Nov 14, 2017 10:20:57 PM",
    "bmNics": [
      {
        "uuid": "f81e9b15830538b9b826e113146f1ed1",
        "baremetalInstanceUuid": "4bf8e15fe39c3b0d8055b7074a522d2d",
        "l3NetworkUuid": "811f43fa4f9f34b9a3a1756911ad9fc1",
        "mac": "6c:b3:11:1b:0b:1e",
        "ip": "192.168.0.10",
        "netmask": "255.255.255.0",
        "gateway": "192.168.0.1",
        "pxe": false
      }
    ]
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error 2.6.0
inventory BaremetalInstanceInventory See inventory 2.6.0

#error

Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 2.6.0
description String The brief description of the error. 2.6.0
details String The details about the error. 2.6.0
elaboration String The reserved field. Default value: null. 2.6.0
opaque LinkedHashMap The reserved field. Default value: null. 2.6.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 2.6.0

#inventory

Name Type Description Starting Version
uuid String The UUID of the bare metal instance. 2.6.0
name String The name of the bare metal instance. 2.6.0
description String The detailed description of the bare metal instance. 2.6.0
zoneUuid String The zone UUID. 2.6.0
clusterUuid String The cluster UUID. 2.6.0
pxeServerUuid String The pxe server UUID. 3.1.1
chassisUuid String The UUID of the bare metal chassis. 2.6.0
imageUuid String The image UUID. 2.6.0
platform String The system platform. 2.6.0
state String The resource state. 2.6.0
status String The resource status. 2.6.0
createDate Timestamp The time when the bare metal instance was created. 2.6.0
lastOpDate Timestamp The time when the bare metal instance was last modified. 2.6.0
bmNics List See bmNics 2.6.0

#bmNics

Name Type Description Starting Version
uuid String The UUID of the NIC of the bare metal instance. 2.6.0
baremetalInstanceUuid String The UUID of the bare metal instance. 2.6.0
l3NetworkUuid String The L3 network UUID. 2.6.0
baremetalBondingUuid String The network bonding UUID. 3.4.0
mac String The MAC address of the bare metal instance. 2.6.0
ip String The IP address of the bare metal instance. 2.6.0
netmask String The netmask of the bare metal instance. 2.6.0
gateway String The gateway of the bare metal instance. 2.6.0
metadata String The metadata. 2.6.0
pxe Boolean Indicates whether the bare metal instance was PXE boot by using its NIC. 2.6.0
createDate Timestamp The time when the bare metal instance was created. 2.6.0
lastOpDate Timestamp The time when the bare metal instance was last modified. 2.6.0

SDK Sample

Java SDK

StopBaremetalInstanceAction action = new StopBaremetalInstanceAction();
action.uuid = "d106a65de4e43667a794a0606a05f724";
action.type = "grace";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
StopBaremetalInstanceAction.Result res = action.call();

Python SDK

action = StopBaremetalInstanceAction()
action.uuid = "d106a65de4e43667a794a0606a05f724"
action.type = "grace"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

UpdateBaremetalInstance

API Request

URLs

PUT zstack/v1/baremetal/instances/{uuid}/actions

Headers

Authorization: OAuth the-session-uuid

Body

{
  "updateBaremetalInstance": {
    "name": "BM-1-RENAMED"
  },
  "systemTags": [],
  "userTags": []
}

In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateBaremetalInstance":{"name":"BM-1-RENAMED"}}' http://localhost:8080/zstack/v1/baremetal/instances/eb538a2a8f17342697593ac468b93d1a/actions

Request Parameters

Name Type Location Description Optional Value Starting Version
uuid String url The UUID of the bare metal instance. 2.6.0
name String body (contained in the updateBaremetalInstance structure) Optional. The name of the bare metal instance. 2.6.0
description String body (contained in the updateBaremetalInstance structure) Optional. The detailed description of the bare metal instance. 2.6.0
password String body (contained in the updateBaremetalInstance structure) Optional. The password of the bare metal instance. 2.6.0
platform String body (contained in the updateBaremetalInstance structure) Optional. The system platform.
  • Linux
2.6.0
systemTags List body Optional. The system tags. 2.6.0
userTags List body Optional. The user tags. 2.6.0

API Response

Sample Response

{
  "inventory": {
    "uuid": "30073bc1b10e3b5eba5db9e54436b1dd",
    "name": "BM-1",
    "description": "This is a baremetal instance.",
    "zoneUuid": "99b8c0883a563feb849fe7c6b0b0b97d",
    "clusterUuid": "38324d028b28352fad5236f861ba7aeb",
    "chassisUuid": "692781dfb73d32d5907ef33199d97db6",
    "imageUuid": "a54bab6133d83045a8941368520eff77",
    "platform": "Linux",
    "state": "Stopped",
    "status": "Provisioned",
    "createDate": "Nov 14, 2017 10:20:57 PM",
    "lastOpDate": "Nov 14, 2017 10:20:57 PM",
    "bmNics": [
      {
        "uuid": "5233971bebdd352c9d708617a23311a4",
        "baremetalInstanceUuid": "30073bc1b10e3b5eba5db9e54436b1dd",
        "l3NetworkUuid": "dce0c157a45d38209afbb615743435aa",
        "mac": "6c:b3:11:1b:0b:1e",
        "ip": "192.168.0.10",
        "netmask": "255.255.255.0",
        "gateway": "192.168.0.1",
        "pxe": false
      }
    ]
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error 2.6.0
inventory BaremetalInstanceInventory See inventory 2.6.0

#error

Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 2.6.0
description String The brief description of the error. 2.6.0
details String The details about the error. 2.6.0
elaboration String The reserved field. Default value: null. 2.6.0
opaque LinkedHashMap The reserved field. Default value: null. 2.6.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 2.6.0

#inventory

Name Type Description Starting Version
uuid String The UUID of the bare metal instance. 2.6.0
name String The name of the bare metal instance. 2.6.0
description String The detailed description of the bare metal instance. 2.6.0
zoneUuid String The zone UUID. 2.6.0
clusterUuid String The cluster UUID. 2.6.0
pxeServerUuid String The pxe server UUID. 3.1.1
chassisUuid String The UUID of the bare metal chassis. 2.6.0
imageUuid String The image UUID. 2.6.0
platform String The system platform. 2.6.0
state String The resource state. 2.6.0
status String The resource status. 2.6.0
createDate Timestamp The time when the bare metal instance was created. 2.6.0
lastOpDate Timestamp The time when the bare metal instance was last modified. 2.6.0
bmNics List See bmNics 2.6.0

#bmNics

Name Type Description Starting Version
uuid String The UUID of the NIC of the bare metal instance. 2.6.0
baremetalInstanceUuid String The UUID of the bare metal instance. 2.6.0
l3NetworkUuid String The L3 network UUID. 2.6.0
baremetalBondingUuid String The network bonding UUID. 3.3.0
mac String The MAC address of the bare metal instance. 2.6.0
ip String The IP address of the bare metal instance. 2.6.0
netmask String The netmask of the bare metal instance. 2.6.0
gateway String The gateway of the bare metal instance. 2.6.0
metadata String The metadata. 2.6.0
pxe Boolean Indicates whether the bare metal instance was PXE boot by using its NIC. 2.6.0
createDate Timestamp The time when the bare metal instance was created. 2.6.0
lastOpDate Timestamp The time when the bare metal instance was last modified. 2.6.0

SDK Sample

Java SDK

UpdateBaremetalInstanceAction action = new UpdateBaremetalInstanceAction();
action.uuid = "eb538a2a8f17342697593ac468b93d1a";
action.name = "BM-1-RENAMED";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateBaremetalInstanceAction.Result res = action.call();

Python SDK

action = UpdateBaremetalInstanceAction()
action.uuid = "eb538a2a8f17342697593ac468b93d1a"
action.name = "BM-1-RENAMED"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

RebootBaremetalInstance

API Request

URLs

PUT zstack/v1/baremetal/instances/{uuid}/actions

Headers

Authorization: OAuth the-session-uuid

Body

{
  "rebootBaremetalInstance": {
    "pxeBoot": false
  },
  "systemTags": [],
  "userTags": []
}

In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"rebootBaremetalInstance":{"pxeBoot":false}}' http://localhost:8080/zstack/v1/baremetal/instances/c3be8e4c6f783f0c9aecd9600b2c3768/actions

Request Parameters

Name Type Location Description Optional Value Starting Version
uuid String url The UUID of the bare metal instance. 2.6.0
pxeBoot Boolean body (contained in the rebootBaremetalInstance structure) Optional. Specifies whether to PXE boot the bare metal instance by using its NIC. 2.6.0
systemTags List body Optional. The system tags. 2.6.0
userTags List body Optional. The user tags. 2.6.0

API Response

Sample Response

{
  "inventory": {
    "uuid": "227ea410fadd38668fb7dd5679d3f095",
    "name": "BM-1",
    "description": "This is a baremetal instance.",
    "zoneUuid": "946022bde3053bf29c7cbbf466241c7f",
    "clusterUuid": "a7b427907a883ae2acf0a6d408eae0e5",
    "chassisUuid": "0746a3cc213a345d89d31bfd82b00e12",
    "imageUuid": "828c0bc2e8f132bc924ed0a616860e66",
    "platform": "Linux",
    "state": "Rebooting",
    "status": "Provisioned",
    "createDate": "Nov 14, 2017 10:20:57 PM",
    "lastOpDate": "Nov 14, 2017 10:20:57 PM",
    "bmNics": [
      {
        "uuid": "fe99549e3f4f3683b4fb37f623de9115",
        "baremetalInstanceUuid": "227ea410fadd38668fb7dd5679d3f095",
        "l3NetworkUuid": "99f6eb7273e936f3ad638ba00b474a4b",
        "mac": "6c:b3:11:1b:0b:1e",
        "ip": "192.168.0.10",
        "netmask": "255.255.255.0",
        "gateway": "192.168.0.1",
        "pxe": false
      }
    ]
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error 2.6.0
inventory BaremetalInstanceInventory See inventory 2.6.0

#error

Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 2.6.0
description String The brief description of the error. 2.6.0
details String The details about the error. 2.6.0
elaboration String The reserved field. Default value: null. 2.6.0
opaque LinkedHashMap The reserved field. Default value: null. 2.6.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 2.6.0

#inventory

Name Type Description Starting Version
uuid String The UUID of the bare metal instance. 2.6.0
name String The name of the bare metal instance. 2.6.0
description String The detailed description of the bare metal instance. 2.6.0
zoneUuid String The zone UUID. 2.6.0
clusterUuid String The cluster UUID. 2.6.0
pxeServerUuid String The pxe server UUID. 3.1.1
chassisUuid String The UUID of the bare metal chassis. 2.6.0
imageUuid String The image UUID. 2.6.0
platform String The system platform. 2.6.0
state String The resource state. 2.6.0
status String The resource status. 2.6.0
createDate Timestamp The time when the bare metal instance was created. 2.6.0
lastOpDate Timestamp The time when the bare metal instance was last modified. 2.6.0
bmNics List See bmNics 2.6.0

#bmNics

Name Type Description Starting Version
uuid String The UUID of the NIC of the bare metal instance. 2.6.0
baremetalInstanceUuid String The UUID of the bare metal instance. 2.6.0
l3NetworkUuid String The L3 network UUID. 2.6.0
baremetalBondingUuid String The network bonding UUID. 3.4.0
mac String The MAC address of the bare metal instance. 2.6.0
ip String The IP address of the bare metal instance. 2.6.0
netmask String The netmask of the bare metal instance. 2.6.0
gateway String The gateway of the bare metal instance. 2.6.0
metadata String The metadata. 2.6.0
pxe Boolean Indicates whether the bare metal instance is PXE boot by using its NIC. 2.6.0
createDate Timestamp The time when the bare metal instance was created. 2.6.0
lastOpDate Timestamp The time when the bare metal instance was last modified. 2.6.0

SDK Sample

Java SDK

RebootBaremetalInstanceAction action = new RebootBaremetalInstanceAction();
action.uuid = "c3be8e4c6f783f0c9aecd9600b2c3768";
action.pxeBoot = false;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
RebootBaremetalInstanceAction.Result res = action.call();

Python SDK

action = RebootBaremetalInstanceAction()
action.uuid = "c3be8e4c6f783f0c9aecd9600b2c3768"
action.pxeBoot = false
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

DestroyBaremetalInstance

API Request

URLs

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

Headers

Authorization: OAuth the-session-uuid

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/baremetal/instances/8f34148a0cce3acf883c6f6b59eb8c0d

Request Parameters

Name Type Location Description Optional Value Starting Version
uuid String url The UUID of the bare metal instance. 2.6.0
deleteMode String body Optional. The mode under which the bare metal instance is deleted. 2.6.0
systemTags List body Optional. The system tags. 2.6.0
userTags List body Optional. The user tags. 2.6.0

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,

{
"error": {
    "code": "SYS.1001",
    "description": "A message or a operation timeout",
    "details": "Create VM on KVM timeout after 300s"
}
}

SDK Sample

Java SDK

DestroyBaremetalInstanceAction action = new DestroyBaremetalInstanceAction();
action.uuid = "8f34148a0cce3acf883c6f6b59eb8c0d";
action.deleteMode = "Permissive";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DestroyBaremetalInstanceAction.Result res = action.call();

Python SDK

action = DestroyBaremetalInstanceAction()
action.uuid = "8f34148a0cce3acf883c6f6b59eb8c0d"
action.deleteMode = "Permissive"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

ExpungeBaremetalInstance

API Request

URLs

PUT zstack/v1/baremetal/instances/{uuid}/actions

Headers

Authorization: OAuth the-session-uuid

Body

{
  "expungeBaremetalInstance": {},
  "systemTags": [],
  "userTags": []
}

In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"expungeBaremetalInstance":{}}' http://localhost:8080/zstack/v1/baremetal/instances/1016135ece1d3b189112cea52ae84d8d/actions

Request Parameters

Name Type Location Description Optional Value Starting Version
uuid String url The UUID of the bare metal instance. 2.6.0
systemTags List body Optional. The system tags. 2.6.0
userTags List body Optional. The user tags. 2.6.0

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,

{
"error": {
    "code": "SYS.1001",
    "description": "A message or a operation timeout",
    "details": "Create VM on KVM timeout after 300s"
}
}

SDK Sample

Java SDK

ExpungeBaremetalInstanceAction action = new ExpungeBaremetalInstanceAction();
action.uuid = "1016135ece1d3b189112cea52ae84d8d";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
ExpungeBaremetalInstanceAction.Result res = action.call();

Python SDK

action = ExpungeBaremetalInstanceAction()
action.uuid = "1016135ece1d3b189112cea52ae84d8d"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

RecoverBaremetalInstance

API Request

URLs

PUT zstack/v1/baremetal/instances/{uuid}/actions

Headers

Authorization: OAuth the-session-uuid

Body

{
  "recoverBaremetalInstance": {},
  "systemTags": [],
  "userTags": []
}

In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"recoverBaremetalInstance":{}}' http://localhost:8080/zstack/v1/baremetal/instances/0a71736890e437928f90415a276ca245/actions

Request Parameters

Name Type Location Description Optional Value Starting Version
uuid String url The UUID of the bare metal instance. 2.6.0
systemTags List body Optional. The system tags. 2.6.0
userTags List body Optional. The user tags. 2.6.0

API Response

Sample Response

{
  "inventory": {
    "uuid": "38471d80059739568ee29b580ee00314",
    "name": "BM-1",
    "description": "This is a baremetal instance.",
    "zoneUuid": "cd3f0df2f33d3d47af58fa92d45e0ed3",
    "clusterUuid": "fc7f9da7d8a53a939a4163619a2e6264",
    "chassisUuid": "36d14ed4da51339eae615f7716724d25",
    "imageUuid": "4eec69d4ae423807bf38164c6d592d86",
    "platform": "Linux",
    "state": "Stopped",
    "status": "Provisioned",
    "createDate": "Nov 14, 2017 10:20:57 PM",
    "lastOpDate": "Nov 14, 2017 10:20:57 PM",
    "bmNics": [
      {
        "uuid": "9e01966b83283f9b967be10fe13ce8bf",
        "baremetalInstanceUuid": "38471d80059739568ee29b580ee00314",
        "l3NetworkUuid": "294c0bcaa1e43fae9abaadef23d72e24",
        "mac": "6c:b3:11:1b:0b:1e",
        "ip": "192.168.0.10",
        "netmask": "255.255.255.0",
        "gateway": "192.168.0.1",
        "pxe": false
      }
    ]
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error 2.6.0
inventory BaremetalInstanceInventory See inventory 2.6.0

#error

Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 2.6.0
description String The brief description of the error. 2.6.0
details String The details about the error. 2.6.0
elaboration String The reserved field. Default value: null. 2.6.0
opaque LinkedHashMap The reserved field. Default value: null. 2.6.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 2.6.0

#inventory

Name Type Description Starting Version
uuid String The UUID of the bare metal instance. 2.6.0
name String The name of the bare metal instance. 2.6.0
description String The detailed description of the bare metal instance. 2.6.0
zoneUuid String The zone UUID. 2.6.0
clusterUuid String The cluster UUID. 2.6.0
pxeServerUuid String The pxe server UUID. 3.1.1
chassisUuid String The UUID of the bare metal chassis. 2.6.0
imageUuid String The image UUID. 2.6.0
platform String The system platform. 2.6.0
state String The resource state. 2.6.0
status String The resource status. 2.6.0
createDate Timestamp The time when the bare metal instance was created. 2.6.0
lastOpDate Timestamp The time when the bare metal instance was last modified. 2.6.0
bmNics List See bmNics 2.6.0

#bmNics

Name Type Description Starting Version
uuid String The UUID of the NIC of the bare metal instance. 2.6.0
baremetalInstanceUuid String The UUID of the bare metal instance. 2.6.0
l3NetworkUuid String The L3 network UUID. 2.6.0
baremetalBondingUuid String The network bonding UUID. 3.4.0
mac String The MAC address of the bare metal instance. 2.6.0
ip String The IP address of the bare metal instance. 2.6.0
netmask String The netmask of the bare metal instance. 2.6.0
gateway String The gateway of the bare metal instance. 2.6.0
metadata String The metadata. 2.6.0
pxe Boolean Indicates whether the bare metal instance was PXE boot by using its NIC. 2.6.0
createDate Timestamp The time when the bare metal instance was created. 2.6.0
lastOpDate Timestamp The time when the bare metal instance was last modified. 2.6.0

SDK Sample

Java SDK

RecoverBaremetalInstanceAction action = new RecoverBaremetalInstanceAction();
action.uuid = "0a71736890e437928f90415a276ca245";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
RecoverBaremetalInstanceAction.Result res = action.call();

Python SDK

action = RecoverBaremetalInstanceAction()
action.uuid = "0a71736890e437928f90415a276ca245"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

CreateBaremetalBonding

API Request

URLs

POST zstack/v1/baremetal/network/bondings

Headers

Authorization: OAuth the-session-uuid

Body

{
  "params": {
    "chassisUuid": "8a3fddc82d1536ad8f695d25d84404f2",
    "name": "bond0",
    "mode": 1.0,
    "slaves": "d4:ae:52:6e:d1:0d,d4:ae:52:6e:d1:04",
    "opts": "miimon=100",
  },
  "systemTags": [],
  "userTags": []
}

In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"chassisUuid":"8a3fddc82d1536ad8f695d25d84404f2","name":"bond0","mode":1.0,"slaves": "d4:ae:52:6e:d1:0d,d4:ae:52:6e:d1:04", "opts": "miimon=100"}}' http://localhost:8080/zstack/v1/baremetal/network/bondings

Request Parameters

Name Type Location Description Optional Value Starting Version
chassisUuid String body (contained in the params structure) The UUID of the bare metal chassis. 3.3.0
name String body (contained in the params structure) The name of the bonded NIC. 3.3.0
mode Integer body (contained in the params structure) The network bonding mode. 3.3.0
slaves String body (contained in the params structure) The bonded slave MAC addresses of the NIC. 3.3.0
opts String body (contained in the params structure) Optional. The network bonding options. 3.3.0
resourceUuid String body (contained in the params structure) Optional. The network bonding UUID. 3.3.0
systemTags List body Optional. The system tags. 3.3.0
userTags List body Optional. The user tags. 3.3.0

API Response

Sample Response

{
  "inventory": {
    "uuid": "a904ce62244c415795da26028fc281b4",
    "chassisUuid": "c034b1866a754e3c88ca7d67770dc8eb",
    "name": "bond0",
    "mode": 1.0,
    "slaves": "d4:ae:52:6e:d1:0d,d4:ae:52:6e:d1:04",
    "opts": "miimon=100",
    "createDate": "Jan 8, 2019 3:06:09 PM",
    "lastOpDate": "Jan 8, 2019 3:06:09 PM"
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error 3.3.0
inventory BaremetalBondingInventory See inventory 3.3.0

#error

Name Name Description Name
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.3.0
description String The brief description of the error. 3.3.0
details String The details about the error. 3.3.0
elaboration String The reserved field. Default value: null. 3.3.0
opaque LinkedHashMap The reserved field. Default value: null. 3.3.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.3.0

#inventory

Name Type Description Starting Version
uuid String The network bonding UUID. 3.3.0
chassisUuid String The UUID of the bare metal chassis. 3.3.0
name String The name of the bonded NIC. 3.3.0
mode Integer The network bonding mode. 3.3.0
slaves String The bonded slave MAC addresses. Each MAC address is separated by a comma (,). 3.3.0
opts String The network bonding options. 3.3.0
createDate Timestamp The time when the network bonding was created. 3.3.0
lastOpDate Timestamp The time when the network bonding was last modified. 3.3.0

SDK Sample

Java SDK

CreateBaremetalBondingAction action = new CreateBaremetalBondingAction();
action.chassisUuid = "8a3fddc82d1536ad8f695d25d84404f2";
action.name = "bond0";
action.mode = 1.0;
action.slaves = "d4:ae:52:6e:d1:0d,d4:ae:52:6e:d1:0e";
action.opts = "miimon=100";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateBaremetalBondingAction.Result res = action.call();

Python SDK

CreateBaremetalBondingAction action = new CreateBaremetalBondingAction();
action.chassisUuid = "8a3fddc82d1536ad8f695d25d84404f2";
action.name = "bond0";
action.mode = 1.0;
action.slaves = "d4:ae:52:6e:d1:0d,d4:ae:52:6e:d1:0e";
action.opts = "miimon=100";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateBaremetalBondingAction.Result res = action.call();

QueryBaremetalBonding

API Request

URLs

GET zstack/v1/baremetal/network/bondings
GET zstack/v1/baremetal/network/bondings/{uuid}

Headers

Authorization: OAuth the-session-uuid

Body

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/baremetal/network/bondings?q=uuid=10d30b226f093a4c9ccd911575406e7b
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/baremetal/network/bondings/e0ea2452b6be30a6a7fbfc01dd5e70f5

Queryable Fields

You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QueryBaremetalBonding, and pressing the Tab key.

API Response

Sample Response

{
  "inventories": [
    {
      "uuid": "6880ed37f7ce4381ae611fd6965696fd",
      "chassisUuid": "59c92fcd611241eb9f55f4b721a62883",
      "name": "bond0",
      "mode": 1.0,
      "slaves": "d4:ae:52:6e:d1:0d,d4:ae:52:6e:d1:04",
      "opts": "miimon=100",
      "createDate": "Jan 8, 2019 3:05:44 PM",
      "lastOpDate": "Jan 8, 2019 3:05:44 PM"
    }
  ]
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error 3.4.0
inventories List See inventories 3.4.0

#error

Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.4.0
description String The brief description of the error. 3.4.0
details String The details about the error. 3.4.0
elaboration String The reserved field. Default value: null. 3.4.0
opaque LinkedHashMap The reserved field. Default value: null. 3.4.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.4.0

#inventories

Name Type Description Starting Version
uuid String The network bonding UUID. 3.4.0
chassisUuid String The UUID of the bare metal chassis. 3.4.0
name String The name of the bonded NIC. 3.4.0
mode Integer The network bonding mode. 3.4.0
slaves String The bonded slave MAC addresses. Each MAC address is separated by a comma (,). 3.4.0
opts String The network bonding options. 3.4.0
createDate Timestamp The time when the network bonding was created. 3.4.0
lastOpDate Timestamp The time when the network bonding was last modified. 3.4.0

SDK Sample

Java SDK

QueryBaremetalBondingAction action = new QueryBaremetalBondingAction();
action.conditions = asList("uuid=eb879ea0b5b93f12aefb1a8bb21cf135");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryBaremetalBondingAction.Result res = action.call();

Python SDK

action = QueryBaremetalBondingAction()
action.conditions = ["uuid=3c90a0f5fb763620ab38cc6184732ea3"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

AddPreconfigurationTemplate

API Request

URLs

POST zstack/v1/baremetal/preconfigurations

Headers

Authorization: OAuth the-session-uuid

Body

{
  "params": {
    "name": "centos-7.2-minimal",
    "description": "centos-7.2-minimal kickstart file",
    "distribution": "centos7.2-x86_64",
    "type": "kickstart",
    "content": "..."
  },
  "systemTags": [],
  "userTags": []
}

In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"name":"centos-7.2-minimal","description":"centos-7.2-minimal kickstart file","distribution":"centos7.2-x86_64","type":"kickstart","content":"..."}}' http://localhost:8080/zstack/v1/baremetal/preconfigurations

Request Parameters

Name Type Location Description Optional Value Starting Version
name String body (contained in the params structure) The name of the preconfigured template. 3.4.0
description String body (contained in the params structure) Optional. The detailed description of the template. 3.4.0
distribution String body (contained in the params structure) The distribution of the operating system. 3.4.0
type String body (contained in the params structure) The type of the template.
  • kickstart
  • preseed
  • autoyast
3.4.0
content String body (contained in the params structure) The content of the template. 3.4.0
resourceUuid String body (contained in the params structure) Optional. The UUID of the template. 3.4.0
systemTags List body Optional. The system tags. 3.4.0
userTags List body Optional. The user tags. 3.4.0

API Response

Sample Response

{
  "inventory": {
    "uuid": "0bfb87d3a9c842bbbf509a4b7eb6e3b2",
    "name": "centos_7_x86_64_mini_v1.cfg",
    "description": "centos-7-minimal kickstart file",
    "distribution": "centos-7-x86_64",
    "type": "kickstart",
    "content": "...",
    "md5sum": "0447e03f5a6747c0984842b5ee117a21",
    "isPredefined": false,
    "state": "Enabled",
    "createDate": "Jan 11, 2019 10:38:59 AM",
    "lastOpDate": "Jan 11, 2019 10:38:59 AM"
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error 3.4.0
inventory PreconfigurationTemplateInventory See inventory 3.4.0

#error

Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.4.0
description String The brief description of the error. 3.4.0
details String The details about the error. 3.4.0
elaboration String The reserved field. Default value: null. 3.4.0
opaque LinkedHashMap The reserved field. Default value: null. 3.4.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.4.0

#inventory

Name Type Description Starting Version
uuid String The UUID of the preconfigured template. 3.4.0
name String The name of the template. 3.4.0
description String The detailed description of the preconfigured template. 3.4.0
distribution String The distribution of the operating system. 3.4.0
type String The type of the template. 3.4.0
content String The content of the template. 3.4.0
md5sum String The MD5 value of the template. 3.4.0
isPredefined Boolean Indicates whether the system of the template was predefined. 3.4.0
state String The state of the template. 3.4.0
createDate Timestamp The time when the template was created. 3.4.0
lastOpDate Timestamp The time when the template was last modified. 3.4.0

SDK Sample

Java SDK

AddPreconfigurationTemplateAction action = new AddPreconfigurationTemplateAction();
action.name = "centos-7.2-minimal";
action.description = "centos-7.2-minimal kickstart file";
action.distribution = "centos7.2-x86_64";
action.type = "kickstart";
action.content = "...";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AddPreconfigurationTemplateAction.Result res = action.call();

Python SDK

action = AddPreconfigurationTemplateAction()
action.name = "centos-7.2-minimal"
action.description = "centos-7.2-minimal kickstart file"
action.distribution = "centos7.2-x86_64"
action.type = "kickstart"
action.content = "..."
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

ChangePreconfigurationTemplateState

API Request

URLs

PUT zstack/v1/baremetal/preconfigurations/{uuid}/actions

Headers

Authorization: OAuth the-session-uuid

Body

{
  "changePreconfigurationTemplateState": {
    "stateEvent": "disable"
  },
  "systemTags": [],
  "userTags": []
}

In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"changePreconfigurationTemplateState":{"stateEvent":"disable"}}' http://localhost:8080/zstack/v1/baremetal/preconfigurations/48e32bae102b30ccb921f582a33cee14/actions

Request Parameters

Name Type Location Description Optional Value Starting Version
uuid String url The UUID of the template. 3.4.0
stateEvent String body(contained in the changePreconfigurationTemplateState structure) The action taken to change the state of the preconfigured template.
  • enable
  • disable
3.4.0
systemTags List body Optional. The system tags. 3.4.0
userTags List body Optional. The user tags. 3.4.0

API Response

Sample Response

{
  "inventory": {
    "uuid": "1bc7b68589b44d7eb906605ceaed3e23",
    "name": "centos_7_x86_64_mini_v1.cfg",
    "description": "centos-7-minimal kickstart file",
    "distribution": "centos-7-x86_64",
    "type": "kickstart",
    "content": "...",
    "md5sum": "b4ddb3884d63478d819b5507df6b21a8",
    "isPredefined": false,
    "state": "Enabled",
    "createDate": "Feb 28, 2019 4:55:38 PM",
    "lastOpDate": "Feb 28, 2019 4:55:38 PM"
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error 3.4.0
inventory PreconfigurationTemplateInventory See inventory 3.4.0

#error

Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.4.0
description String The brief description of the error. 3.4.0
details String The details about the error. 3.4.0
elaboration String The reserved field. Default value: null. 3.4.0
opaque LinkedHashMap The reserved field. Default value: null. 3.4.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.4.0

#inventory

Name Type Description Starting Version
uuid String The UUID of the preconfigured template. 3.4.0
name String The name of the template. 3.4.0
description String The detailed description of the preconfigured template. 3.4.0
distribution String The distribution of the operating system. 3.4.0
type String The type of the template. 3.4.0
content String The content of the template. 3.4.0
md5sum String The MD5 value of the template. 3.4.0
isPredefined Boolean Indicates whether the system of the template was predefined. 3.4.0
state String The state of the template. 3.4.0
createDate Timestamp The time when the template was created. 3.4.0
lastOpDate Timestamp The time when the template was last modified. 3.4.0

SDK Sample

Java SDK

ChangePreconfigurationTemplateStateAction action = new ChangePreconfigurationTemplateStateAction();
action.uuid = "48e32bae102b30ccb921f582a33cee14";
action.stateEvent = "disable";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
ChangePreconfigurationTemplateStateAction.Result res = action.call();

Python SDK

action = ChangePreconfigurationTemplateStateAction()
action.uuid = "48e32bae102b30ccb921f582a33cee14"
action.stateEvent = "disable"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

DeletePreconfigurationTemplate

API Request

URLs

DELETE zstack/v1/baremetal/preconfigurations/{uuid}

Headers

Authorization: OAuth the-session-uuid

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/baremetal/preconfigurations/5a236fbddd5e46a6ab6e634a5c8b8e68

Request Parameters

Name Type Location Description Optional Value Starting Version
uuid String url The UUID of the preconfigured template. 3.4.0
deleteMode String body Optional. The mode under which the template is deleted. 3.4.0
systemTags List body Optional. The system tags. 3.4.0
userTags List body Optional. The user tags. 3.4.0

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,

{
    "error": {
        "code": "SYS.1001",
        "description": "A message or a operation timeout",
        "details": "Create VM on KVM timeout after 300s"
    }
}

SDK Sample

Java SDK

DeletePreconfigurationTemplateAction action = new DeletePreconfigurationTemplateAction();
action.uuid = "d5624ed789d14c10a35bc68f0a8c803d";
action.deleteMode = "Permissive";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeletePreconfigurationTemplateAction.Result res = action.call();

Python SDK

action = DeletePreconfigurationTemplateAction()
action.uuid = "45495daa9c6542fd82a4ed00e2ce6023"
action.deleteMode = "Permissive"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

UpdatePreconfigurationTemplate

API Request

URLs

PUT zstack/v1/baremetal/preconfigurations/{uuid}/actions

Headers

Authorization: OAuth the-session-uuid

Body

{
  "updatePreconfigurationTemplate": {
    "name": "centos-7.2-minimal",
    "description": "centos-7.2-minimal kickstart file",
    "distribution": "centos7.2-x86_64",
    "type": "kickstart",
    "content": "..."
  },
  "systemTags": [],
  "userTags": []
}

In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updatePreconfigurationTemplate":{"name":"centos-7.2-minimal","description":"centos-7.2-minimal kickstart file","distribution":"centos7.2-x86_64","type":"kickstart","content":"..."}}' http://localhost:8080/zstack/v1/baremetal/preconfigurations/a4f774d88df141749f077f7df185a0e3/actions

Request Parameters

Name Type Location Description Optional Value Starting Version
uuid String url The UUID of the preconfigured template. 3.4.0
name String body (contained in the updatePreconfigurationTemplate structure) Optional. The name of the template. 3.4.0
description String body (contained in the updatePreconfigurationTemplate structure) Optional. The detailed description of the template. 3.4.0
distribution String body (contained in the updatePreconfigurationTemplate structure) Optional. The distribution of the operating system. 3.4.0
type String body (contained in the updatePreconfigurationTemplate structure) Optional. The type of the template.
  • kickstart
  • preseed
  • autoyast
3.4.0
content String body (contained in the updatePreconfigurationTemplate structure) Optional. The content of the template. 3.4.0
systemTags List body Optional. The system tags. 3.4.0
userTags List body Optional. The user tags. 3.4.0

API Response

Sample Response

{
  "inventory": {
    "uuid": "fee95538b8a64831a9f29b972bcdf165",
    "name": "centos_7_x86_64_mini_v1.cfg",
    "description": "centos-7-minimal kickstart file",
    "distribution": "centos-7-x86_64",
    "type": "kickstart",
    "content": "...",
    "md5sum": "6c5fbedaf16f4682840a3a2c9b712b21",
    "isPredefined": false,
    "state": "Enabled",
    "createDate": "Jan 11, 2019 10:38:58 AM",
    "lastOpDate": "Jan 11, 2019 10:38:58 AM"
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error 3.4.0
inventory PreconfigurationTemplateInventory See 3.4.0

#error

Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.4.0
description String The brief description of the error. 3.4.0
details String The details about the error. 3.4.0
elaboration String The reserved field. Default value: null. 3.4.0
opaque LinkedHashMap The reserved field. Default value: null. 3.4.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.4.0

#inventory

Name Type Description Starting Version
uuid String The UUID of the preconfigured template. 3.4.0
name String The name of the template. 3.4.0
description String The detailed description of the preconfigured template. 3.4.0
distribution String The distribution of the operating system. 3.4.0
type String The type of the template. 3.4.0
content String The content of the template. 3.4.0
md5sum String The MD5 value of the template. 3.4.0
isPredefined Boolean Indicates whether the system of the template was predefined. 3.4.0
state String The state of the template. 3.4.0
createDate Timestamp The time when the template was created. 3.4.0
lastOpDate Timestamp The time when the template was last modified. 3.4.0

SDK Sample

Java SDK

UpdatePreconfigurationTemplateAction action = new UpdatePreconfigurationTemplateAction();
action.uuid = "2dd907badf9e4ff994986173aee0402f";
action.name = "centos-7.2-minimal";
action.description = "centos-7.2-minimal kickstart file";
action.distribution = "centos7.2-x86_64";
action.type = "kickstart";
action.content = "...";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdatePreconfigurationTemplateAction.Result res = action.call();

Python SDK

action = UpdatePreconfigurationTemplateAction()
action.uuid = "9abdf90afc1b4ddcbf1eb1357c6b6229"
action.name = "centos-7.2-minimal"
action.description = "centos-7.2-minimal kickstart file"
action.distribution = "centos7.2-x86_64"
action.type = "kickstart"
action.content = "..."
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

QueryPreconfigurationTemplate

API Request

URLs

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

Headers

Authorization: OAuth the-session-uuid

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/baremetal/preconfigurations?q=uuid=6b34fcf11d6732ba851203bc602b46b7
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/baremetal/preconfigurations/ed428c815ff43f1ebc97483767b1a6e4

Queryable Fields

You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QueryPreconfigurationTemplate, and pressing the Tab key.

API Response

Sample Response

{
  "inventories": [
    {
      "uuid": "d55e08748c1d424dbcb7b311dbff56c6",
      "name": "centos_7_x86_64_mini_v1.cfg",
      "description": "centos-7-minimal kickstart file",
      "distribution": "centos-7-x86_64",
      "type": "kickstart",
      "content": "...",
      "md5sum": "7a5bf28bb4164419923a98a63a34680f",
      "isPredefined": false,
      "state": "Enabled",
      "createDate": "Feb 28, 2019 4:55:50 PM",
      "lastOpDate": "Feb 28, 2019 4:55:50 PM"
    }
  ]
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error 3.4.0
inventories List See inventories 3.4.0

#error

Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.4.0
description String The brief description of the error. 3.4.0
details String The details about the error. 3.4.0
elaboration String The reserved field. Default value: null. 3.4.0
opaque LinkedHashMap The reserved field. Default value: null. 3.4.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.4.0

#inventories

Name Type Description Starting Version
uuid String The UUID of the preconfigured template. 3.4.0
name String The name of the template. 3.4.0
description String The detailed description of the preconfigured template. 3.4.0
distribution String The distribution of the operating system. 3.4.0
type String The type of the template. 3.4.0
content String The content of the template. 3.4.0
md5sum String The MD5 value of the template. 3.4.0
isPredefined Boolean Indicates whether the system of the template was predefined. 3.4.0
state String The state of the template. 3.4.0
createDate Timestamp The time when the template was created. 3.4.0
lastOpDate Timestamp The time when the template was last modified. 3.4.0

SDK Sample

Java SDK

QueryPreconfigurationTemplateAction action = new QueryPreconfigurationTemplateAction();
action.conditions = asList("uuid=c3cd8741c2fb3ba88f0493ec77b8fad6");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryPreconfigurationTemplateAction.Result res = action.call();

Python SDK

action = QueryPreconfigurationTemplateAction()
action.conditions = ["uuid=deb4635e9984326b818d0433dfd78576"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

Installation Service Operations

CreateBaremetalPxeServer

API Request

URLs

POST zstack/v1/baremetal/pxeservers

Headers

Authorization: OAuth the-session-uuid

Body

{
  "params": {
    "zoneUuid": "4d813a1e8053335d931094e4f41c0cad",
    "name": "test",
    "hostname": "127.0.0.1",
    "sshUsername": "root",
    "sshPassword": "password",
    "sshPort": 22.0,
    "storagePath": "/zstack_bm_cache",
    "dhcpInterface": "eth0",
    "dhcpRangeBegin": "10.0.0.1",
    "dhcpRangeEnd": "10.0.0.255",
    "dhcpRangeNetmask": "255.255.255.0"
  },
  "systemTags": [],
  "userTags": []
}

In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"zoneUuid":"4d813a1e8053335d931094e4f41c0cad","name":"test","hostname":"127.0.0.1","sshUsername":"root","sshPassword":"password","sshPort":22.0,"storagePath":"/zstack_bm_cache","dhcpInterface":"eth0","dhcpRangeBegin":"10.0.0.1","dhcpRangeEnd":"10.0.0.255","dhcpRangeNetmask":"255.255.255.0"}}' http://localhost:8080/zstack/v1/baremetal/pxeservers

Request Parameters

Name Type Location Description Optional Value Starting Version
name String body (contained in the params structure) The name of the deployment server. 3.1.1
description String body (contained in the params structure) Optional. The detailed description of the deployment server. 3.1.1
dhcpInterface String body (contained in the params structure) The DHCP NIC of the deployment server. 3.1.1
dhcpRangeBegin String body (contained in the params structure) Optional. The starting IP address that DHCP assigns to a bare metal instance. 3.1.1
dhcpRangeEnd String body (contained in the params structure) Optional. The ending IP address that DHCP assigns to a bare metal instance. 3.1.1
dhcpRangeNetmask String body (contained in the params structure) Optional. The netmask of the IP range from which the DHCP server assigns an IP address to a bare metal instance. 3.1.1
zoneUuid String body (contained in the params structure) The zone UUID. 3.1.1
hostname String body (contained in the params structure) The hostname. 3.1.1
sshUsername String body (contained in the params structure) The SSH username. 3.1.1
sshPassword String body (contained in the params structure) The SSH password. 3.1.1
sshPort Integer body (contained in the params structure) Optional. 3.1.1
storagePath String body (contained in the params structure) The storage path. 3.1.1
resourceUuid String body (contained in the params structure) Optional. 3.1.1
systemTags List body Optional. The system tags. 3.1.1
userTags List body Optional. The user tags. 3.1.1

API Response

Sample Response

{
  "inventory": {
    "uuid": "e958961c7785304691d49ec5ac7df64d",
    "name": "test",
    "hostname": "127.0.0.1",
    "sshUsername": "root",
    "sshPassword": "password",
    "sshPort": 22.0,
    "storagePath": "/zstack_bm_cache",
    "dhcpInterface": "eth0",
    "dhcpRangeBegin": "10.0.0.1",
    "dhcpRangeEnd": "10.0.0.255",
    "dhcpRangeNetmask": "255.255.255.0",
    "state": "Enabled",
    "status": "Connecting"
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error 3.1.1
inventory BaremetalPxeServerInventory See inventory 3.1.1

#error

Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.1.1
description String The brief description of the error. 3.1.1
details String The details about the error. 3.1.1
elaboration String The reserved field. Default value: null. 3.1.1
opaque LinkedHashMap The reserved field. Default value: null. 3.1.1
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.1.1

#inventory

Name Type Description Starting Version
uuid String The UUID of the deployment server. 3.1.1
zoneUuid String The zone UUID. 3.1.1
name String The name of the deployment server. 3.1.1
description String The detailed description of the deployment server. 3.1.1
hostname String The IP address of the deployment server. 3.1.1
sshUsername String The SSH username of the deployment server. 3.1.1
sshPassword String The SSH password of the deployment server. 3.1.1
sshPort Integer The SSH port of the deployment server. 3.1.1
storagePath String The storage path of the deployment server. 3.1.1
dhcpInterface String The DHCP NIC of the deployment server. 3.1.1
dhcpInterfaceAddress String The IP address of the DHCP NIC of the deployment server. 3.1.1
dhcpRangeBegin String The starting IP address that DHCP assigns to a bare metal instance. 3.1.1
dhcpRangeEnd String The ending IP address that DHCP assigns to a bare metal instance. 3.1.1
dhcpRangeNetmask String The netmask of the IP range from which DHCP assigns an IP address to a bare metal instance. 3.1.1
state String The operating status of the deployment server. 3.1.1
status String The connection status of the deployment server. 3.1.1
createDate Timestamp The time when the deployment server was created. 3.1.1
lastOpDate Timestamp The time when the deployment server was last modified. 3.1.1
totalCapacity Long The total storage capacity in the specified storage path. 3.1.1
availableCapacity Long The available storage space in the specified storage path. 3.1.1
attachedClusterUuids List The UUIDs of the clusters to which the deployment server is attached. 3.1.1

SDK Sample

Java SDK

CreateBaremetalPxeServerAction action = new CreateBaremetalPxeServerAction();
action.zoneUuid = "4d813a1e8053335d931094e4f41c0cad";
action.name = "test";
action.hostname = "127.0.0.1";
action.sshUsername = "root";
action.sshPassword = "password";
action.sshPort = 22.0;
action.storagePath = "/zstack_bm_cache";
action.dhcpInterface = "eth0";
action.dhcpRangeBegin = "10.0.0.1";
action.dhcpRangeEnd = "10.0.0.255";
action.dhcpRangeNetmask = "255.255.255.0";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateBaremetalPxeServerAction.Result res = action.call();

Python SDK

action = CreateBaremetalPxeServerAction()
action.zoneUuid = "4d813a1e8053335d931094e4f41c0cad"
action.name = "test"
action.hostname = "127.0.0.1"
action.sshUsername = "root"
action.sshPassword = "password"
action.sshPort = 22.0
action.storagePath = "/zstack_bm_cache"
action.dhcpInterface = "eth0"
action.dhcpRangeBegin = "10.0.0.1"
action.dhcpRangeEnd = "10.0.0.255"
action.dhcpRangeNetmask = "255.255.255.0"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

DeleteBaremetalPxeServer

API Request

URLs

DELETE zstack/v1/baremetal/pxeservers/{uuid}

Headers

Authorization: OAuth the-session-uuid

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/baremetal/pxeservers/da517231390c368b91440d0bda783ba1

Request Parameters

Name Type Location Description Optional Value Starting Version
uuid String url The UUID of the deployment server. 2.6.0
deleteMode String body Optional. The mode under which the bare metal chassis is deleted. 2.6.0
systemTags List body Optional. The system tags. 2.6.0
userTags List body Optional. The user tags. 2.6.0

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,

{
"error": {
    "code": "SYS.1001",
    "description": "A message or a operation timeout",
    "details": "Create VM on KVM timeout after 300s"
}
}

SDK Sample

Java SDK

DeleteBaremetalPxeServerAction action = new DeleteBaremetalPxeServerAction();
action.uuid = "da517231390c368b91440d0bda783ba1";
action.deleteMode = "Permissive";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeleteBaremetalPxeServerAction.Result res = action.call();

Python SDK

action = DeleteBaremetalPxeServerAction()
action.uuid = "da517231390c368b91440d0bda783ba1"
action.deleteMode = "Permissive"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

QueryBaremetalPxeServer

API Request

URLs

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

Headers

Authorization: OAuth the-session-uuid

Curl Sample

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

Queryable Fields

You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QueryBaremetalPxeServer, and pressing the Tab key.

API Response

Sample Response

{
  "inventories": [
    {
      "uuid": "90afdd2b218b376592a25421e396597e",
      "name": "test",
      "hostname": "127.0.0.1",
      "sshUsername": "root",
      "sshPassword": "password",
      "sshPort": 22.0,
      "storagePath": "/zstack_bm_cache",
      "dhcpInterface": "eth0",
      "dhcpRangeBegin": "10.0.0.1",
      "dhcpRangeEnd": "10.0.0.255",
      "dhcpRangeNetmask": "255.255.255.0",
      "state": "Enabled",
      "status": "Connected"
    }
  ]
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error 2.6.0
inventories List See inventories 2.6.0

#error

Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 2.6.0
description String The brief description of the error. 2.6.0
details String The details about the error. 2.6.0
elaboration String The reserved field. Default value: null. 2.6.0
opaque LinkedHashMap The reserved field. Default value: null. 2.6.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 2.6.0

#inventories

Name Type Description Starting Version
uuid String The UUID of the deployment server. 3.1.1
zoneUuid String The zone UUID. 3.1.1
name String The name of the deployment server. 3.1.1
description String The detailed description of the deployment server. 3.1.1
hostname String The IP address of the deployment server. 3.1.1
sshUsername String The SSH username of the deployment server. 3.1.1
sshPassword String The SSH password of the deployment server. 3.1.1
sshPort Integer The SSH port of the deployment server. 3.1.1
storagePath String The storage path of the deployment server. 3.1.1
dhcpInterface String The DHCP NIC of the deployment server. 3.1.1
dhcpRangeBegin String The starting IP address that DHCP assigns to a bare metal instance. 3.1.1
dhcpRangeEnd String The ending IP address that DHCP assigns to a bare metal instance. 3.1.1
dhcpRangeNetmask String The netmask of the IP range from which DHCP assigns an IP address to a bare metal instance. 3.1.1
state String The operating status of the deployment server. 3.1.1
status String The connection status of the deployment server. 3.1.1
createDate Timestamp The time when the deployment server was created. 3.1.1
lastOpDate Timestamp The time when the deployment server was last modified. 3.1.1
totalCapacity Long The total storage capacity in the specified storage path. 3.1.1
availableCapacity Long The available storage space in the specified storage path. 3.1.1
attachedClusterUuids List The UUIDs of the clusters to which the deployment server is attached. 3.1.1

SDK Sample

Java SDK

QueryBaremetalPxeServerAction action = new QueryBaremetalPxeServerAction();
action.conditions = asList("uuid=543c0df623633fe0a0158e955b1a5702");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryBaremetalPxeServerAction.Result res = action.call();

Python SDK

action = QueryBaremetalPxeServerAction()
action.conditions = ["uuid=a065f4830c9f301ead495e941ce7bd4e"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

StartBaremetalPxeServer

API Request

URLs

PUT zstack/v1/baremetal/pxeservers/{uuid}/actions

Headers

Authorization: OAuth the-session-uuid

Body

{
  "startBaremetalPxeServer": {},
  "systemTags": [],
  "userTags": []
}

In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"startBaremetalPxeServer":{}}' http://localhost:8080/zstack/v1/baremetal/pxeservers/340b1f6b12ab305aa05c12ded00020e7/actions

Request Parameters

Name Type Location Description Optional Value Starting Version
uuid String url The UUID of the deployment server. 2.6.0
systemTags List body Optional. The system tags. 2.6.0
userTags List body Optional. The user tags. 2.6.0

API Response

Sample Response

{
  "inventory": {
    "uuid": "ac3a53373cfd328b8932bdd29f4886dd",
    "name": "test",
    "hostname": "127.0.0.1",
    "sshUsername": "root",
    "sshPassword": "password",
    "sshPort": 22.0,
    "storagePath": "/zstack_bm_cache",
    "dhcpInterface": "eth0",
    "dhcpRangeBegin": "10.0.0.1",
    "dhcpRangeEnd": "10.0.0.255",
    "dhcpRangeNetmask": "255.255.255.0",
    "state": "Enabled",
    "status": "Connected"
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error 2.6.0

#error

Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 2.6.0
description String The brief description of the error. 2.6.0
details String The details about the error. 2.6.0
elaboration String The reserved field. Default value: null. 2.6.0
opaque LinkedHashMap The reserved field. Default value: null. 2.6.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 2.6.0

SDK Sample

Java SDK

StartBaremetalPxeServerAction action = new StartBaremetalPxeServerAction();
action.uuid = "340b1f6b12ab305aa05c12ded00020e7";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
StartBaremetalPxeServerAction.Result res = action.call();

Python SDK

action = StartBaremetalPxeServerAction()
action.uuid = "340b1f6b12ab305aa05c12ded00020e7"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

StopBaremetalPxeServer

API Request

URLs

PUT zstack/v1/baremetal/pxeservers/{uuid}/actions

Headers

Authorization: OAuth the-session-uuid

Body

{
  "stopBaremetalPxeServer": {},
  "systemTags": [],
  "userTags": []
}

In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"stopBaremetalPxeServer":{}}' http://localhost:8080/zstack/v1/baremetal/pxeservers/26a3032ad77330df8de53c6d89f02f12/actions

Request Parameters

Name Type Location Description Optional Value Starting Version
uuid String url The UUID of the deployment server. 2.6.0
systemTags List body Optional. The system tags. 2.6.0
userTags List body Optional. The user tags. 2.6.0

API Response

Sample Response

{
  "inventory": {
    "uuid": "743173fddfb0319fa9b21827875c1341",
    "name": "test",
    "hostname": "127.0.0.1",
    "sshUsername": "root",
    "sshPassword": "password",
    "sshPort": 22.0,
    "storagePath": "/zstack_bm_cache",
    "dhcpInterface": "eth0",
    "dhcpRangeBegin": "10.0.0.1",
    "dhcpRangeEnd": "10.0.0.255",
    "dhcpRangeNetmask": "255.255.255.0",
    "state": "Enabled",
    "status": "Disconnected"
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error 2.6.0

#error

Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 2.6.0
description String The brief description of the error. 2.6.0
details String The details about the error. 2.6.0
elaboration String The reserved field. Default value: null. 2.6.0
opaque LinkedHashMap The reserved field. Default value: null. 2.6.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 2.6.0

SDK Sample

Java SDK

StopBaremetalPxeServerAction action = new StopBaremetalPxeServerAction();
action.uuid = "26a3032ad77330df8de53c6d89f02f12";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
StopBaremetalPxeServerAction.Result res = action.call();

Python SDK

action = StopBaremetalPxeServerAction()
action.uuid = "26a3032ad77330df8de53c6d89f02f12"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

UpdateBaremetalPxeServer

API Request

URLs

PUT zstack/v1/baremetal/pxeservers/{uuid}/actions

Headers

Authorization: OAuth the-session-uuid

Body

{
  "updateBaremetalPxeServer": {
    "name": "test",
    "hostname": "127.0.0.1",
    "sshUsername": "root",
    "sshPassword": "password",
    "sshPort": 22.0,
    "storagePath": "/zstack_bm_cache",
    "dhcpRangeBegin": "10.0.0.200",
    "dhcpRangeNetmask": "255.255.255.0",
    "state": "Enabled",
    "status": "Connected"
  },
  "systemTags": [],
  "userTags": []
}

In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateBaremetalPxeServer":{"name":"test","dhcpRangeBegin":"10.0.0.200","dhcpRangeNetmask":"255.255.255.0"}}' http://localhost:8080/zstack/v1/baremetal/pxeservers/da1ddf8e5ca838ea9fa55f20946dded6/actions

Request Parameters

Name Type Location Description Optional Value Starting Version
uuid String url The UUID of the deployment server. 2.6.0
name String body (contained in the updateBaremetalPxeServer structure) Optional. The name of the deployment server. 2.6.0
description String body (contained in the updateBaremetalPxeServer structure) Optional. The detailed description of the deployment server. 2.6.0
dhcpInterface String body (contained in the updateBaremetalPxeServer structure) Optional. The DHCP NIC of the deployment server. 2.6.0
dhcpRangeBegin String body (contained in the updateBaremetalPxeServer structure) Optional. The starting IP address that DHCP assigns to a bare metal instance. 2.6.0
dhcpRangeEnd String body (contained in the updateBaremetalPxeServer structure) Optional. The ending IP address that DHCP assigns to a bare metal instance. 2.6.0
dhcpRangeNetmask String body (contained in the updateBaremetalPxeServer structure) Optional. The netmask of the IP range from which the DHCP server assigns an IP address to a bare metal instance. 2.6.0
systemTags List body Optional. The system tags. 2.6.0
userTags List body Optional. The user tags. 2.6.0

API Response

Sample Response

{
  "inventory": {
    "uuid": "1a88afcfd21b35aa82da9f4b734826b7",
    "name": "test",
    "dhcpInterface": "eth0",
    "dhcpRangeBegin": "10.0.0.1",
    "dhcpRangeEnd": "10.0.0.255",
    "dhcpRangeNetmask": "255.255.255.0"
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error 2.6.0
inventory BaremetalPxeServerInventory See inventory 2.6.0

#error

Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 2.6.0
description String The brief description of the error. 2.6.0
details String The details about the error. 2.6.0
elaboration String The reserved field. Default value: null. 2.6.0
opaque LinkedHashMap The reserved field. Default value: null. 2.6.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 2.6.0

#inventory

Name Type Description Starting Version
uuid String The UUID of the deployment server. 3.1.1
zoneUuid String The zone UUID. 3.1.1
name String The name of the deployment server. 3.1.1
description String The detailed description of the deployment server. 3.1.1
hostname String The IP address of the deployment server. 3.1.1
sshUsername String The SSH username of the deployment server. 3.1.1
sshPassword String The SSH password of the deployment server. 3.1.1
sshPort Integer The SSH port of the deployment server. 3.1.1
storagePath String The storage path of the deployment server. 3.1.1
dhcpInterface String The DHCP NIC of the deployment server. 3.1.1
dhcpRangeBegin String The starting IP address that DHCP assigns to a bare metal instance. 3.1.1
dhcpRangeEnd String The ending IP address that DHCP assigns to a bare metal instance. 3.1.1
dhcpRangeNetmask String The netmask of the IP range from which DHCP assigns an IP address to a bare metal instance. 3.1.1
state String The operating status of the deployment server. 3.1.1
status String The connection status of the deployment server. 3.1.1
createDate Timestamp The time when the deployment server was created. 3.1.1
lastOpDate Timestamp The time when the deployment server was last modified. 3.1.1
totalCapacity Long The total storage capacity in the specified storage path. 3.1.1
availableCapacity Long The available storage space in the specified storage path. 3.1.1
attachedClusterUuids List The UUIDs of the clusters to which the deployment server is attached. 3.1.1

SDK Sample

Java SDK

UpdateBaremetalPxeServerAction action = new UpdateBaremetalPxeServerAction();
action.uuid = "da1ddf8e5ca838ea9fa55f20946dded6";
action.name = "test";
action.dhcpRangeBegin = "10.0.0.200";
action.dhcpRangeNetmask = "255.255.255.0";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateBaremetalPxeServerAction.Result res = action.call();

Python SDK

action = UpdateBaremetalPxeServerAction()
action.uuid = "da1ddf8e5ca838ea9fa55f20946dded6"
action.name = "test"
action.dhcpRangeBegin = "10.0.0.200"
action.dhcpRangeNetmask = "255.255.255.0"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

ReconnectBaremetalPxeServer

API Request

URLs

PUT zstack/v1/baremetal/pxeservers/{uuid}/actions

Headers

Authorization: OAuth the-session-uuid

Body

{
  "reconnectBaremetalPxeServer": {},
  "systemTags": [],
  "userTags": []
}

In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"reconnectBaremetalPxeServer":{}}' http://localhost:8080/zstack/v1/baremetal/pxeservers/65273a162ba83a4d99abc6ede60e6eeb/actions

Request Parameters

Name Type Location Description Optional Value Starting Version
uuid String url The UUID of the deployment server. 3.1.1
systemTags List body Optional. The system tags. 3.1.1
userTags List body Optional. The user tags. 3.1.1

API Response

Sample Response

{
  "inventory": {
    "uuid": "95c83db8181c31ea84f2ed95b3800501",
    "name": "test",
    "hostname": "127.0.0.1",
    "sshUsername": "root",
    "sshPassword": "password",
    "sshPort": 22.0,
    "storagePath": "/zstack_bm_cache",
    "dhcpInterface": "eth0",
    "dhcpRangeBegin": "10.0.0.1",
    "dhcpRangeEnd": "10.0.0.255",
    "dhcpRangeNetmask": "255.255.255.0",
    "state": "Enabled",
    "status": "Connected"
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error 3.1.1
inventory BaremetalPxeServerInventory See inventory 3.1.1

#error

Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.1.1
description String The brief description of the error. 3.1.1
details String The details about the error. 3.1.1
elaboration String The reserved field. Default value: null. 3.1.1
opaque LinkedHashMap The reserved field. Default value: null. 3.1.1
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.1.1

#inventory

Name Type Description Starting Version
uuid String The UUID of the deployment server. 3.1.1
zoneUuid String The zone UUID. 3.1.1
name String The name of the deployment server. 3.1.1
description String The detailed description of the deployment server. 3.1.1
hostname String The IP address of the deployment server. 3.1.1
sshUsername String The SSH username of the deployment server. 3.1.1
sshPassword String The SSH password of the deployment server. 3.1.1
sshPort Integer The SSH port of the deployment server. 3.1.1
storagePath String The storage path of the deployment server. 3.1.1
dhcpInterface String The DHCP NIC of the deployment server. 3.1.1
dhcpRangeBegin String The starting IP address that DHCP assigns to a bare metal instance. 3.1.1
dhcpRangeEnd String The ending IP address that DHCP assigns to a bare metal instance. 3.1.1
dhcpRangeNetmask String The netmask of the IP range from which DHCP assigns an IP address to a bare metal instance. 3.1.1
state String The operating status of the deployment server. 3.1.1
status String The connection status of the deployment server. 3.1.1
createDate Timestamp The time when the deployment server was created. 3.1.1
lastOpDate Timestamp The time when the deployment server was last modified. 3.1.1
totalCapacity Long The total storage capacity in the specified storage path. 3.1.1
availableCapacity Long The available storage space in the specified storage path. 3.1.1
attachedClusterUuids List The UUIDs of the clusters to which the deployment server is attached. 3.1.1

SDK Sample

Java SDK

ReconnectBaremetalPxeServerAction action = new ReconnectBaremetalPxeServerAction();
action.uuid = "65273a162ba83a4d99abc6ede60e6eeb";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
ReconnectBaremetalPxeServerAction.Result res = action.call();

Python SDK

action = ReconnectBaremetalPxeServerAction()
action.uuid = "65273a162ba83a4d99abc6ede60e6eeb"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

AttachBaremetalPxeServerToCluster

API Request

URLs

POST zstack/v1/clusters/{clusterUuid}/pxeservers/{pxeServerUuid}

Headers

Authorization: OAuth the-session-uuid

Body

{
  "params": {},
  "systemTags": [],
  "userTags": []
}

In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{}}' http://localhost:8080/zstack/v1/clusters/47b43452a77a309e9c9e1b3b23a9e978/pxeservers/b069eaeb0e2c355aaabca9738fb8332b

Request Parameters

Name Type Location Description Optional Value Starting Version
pxeServerUuid String url The UUID of the deployment server. 3.1.1
clusterUuid String url The UUID of the bare metal cluster. 3.1.1
systemTags List body Optional. The system tags. 3.1.1
userTags List body Optional. The user tags. 3.1.1

API Response

Sample Response

{
  "inventory": {
    "uuid": "976aafa241603b26acb48dce89e29dec",
    "name": "test",
    "hostname": "127.0.0.1",
    "sshUsername": "root",
    "sshPassword": "password",
    "sshPort": 22.0,
    "storagePath": "/zstack_bm_cache",
    "dhcpInterface": "eth0",
    "dhcpRangeBegin": "10.0.0.1",
    "dhcpRangeEnd": "10.0.0.255",
    "dhcpRangeNetmask": "255.255.255.0",
    "state": "Enabled",
    "status": "Disconnected"
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error 3.1.1
inventory BaremetalPxeServerInventory See inventory 3.1.1

#error

Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.1.1
description String The brief description of the error. 3.1.1
details String The details about the error. 3.1.1
elaboration String The reserved field. Default value: null. 3.1.1
opaque LinkedHashMap The reserved field. Default value: null. 3.1.1
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.1.1

#inventory

Name Type Description Starting Version
uuid String The UUID of the deployment server. 3.1.1
zoneUuid String The zone UUID. 3.1.1
name String The name of the deployment server. 3.1.1
description String The detailed description of the deployment server. 3.1.1
hostname String The IP address of the deployment server. 3.1.1
sshUsername String The SSH username of the deployment server. 3.1.1
sshPassword String The SSH password of the deployment server. 3.1.1
sshPort Integer The SSH port of the deployment server. 3.1.1
storagePath String The storage path of the deployment server. 3.1.1
dhcpInterface String The DHCP NIC of the deployment server. 3.1.1
dhcpRangeBegin String The starting IP address that DHCP assigns to a bare metal instance. 3.1.1
dhcpRangeEnd String The ending IP address that DHCP assigns to a bare metal instance. 3.1.1
dhcpRangeNetmask String The netmask of the IP range from which DHCP assigns an IP address to a bare metal instance. 3.1.1
state String The operating status of the deployment server. 3.1.1
status String The connection status of the deployment server. 3.1.1
createDate Timestamp The time when the deployment server was created. 3.1.1
lastOpDate Timestamp The time when the deployment server was last modified. 3.1.1
totalCapacity Long The total storage capacity in the specified storage path. 3.1.1
availableCapacity Long The available storage space in the specified storage path. 3.1.1
attachedClusterUuids List The UUIDs of the clusters to which the deployment server is attached. 3.1.1

SDK Sample

Java SDK

AttachBaremetalPxeServerToClusterAction action = new AttachBaremetalPxeServerToClusterAction();
action.pxeServerUuid = "b069eaeb0e2c355aaabca9738fb8332b";
action.clusterUuid = "47b43452a77a309e9c9e1b3b23a9e978";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AttachBaremetalPxeServerToClusterAction.Result res = action.call();

Python SDK

action = AttachBaremetalPxeServerToClusterAction()
action.pxeServerUuid = "b069eaeb0e2c355aaabca9738fb8332b"
action.clusterUuid = "47b43452a77a309e9c9e1b3b23a9e978"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

DetachBaremetalPxeServerFromCluster

API Request

URLs

DELETE zstack/v1/clusters/{clusterUuid}/pxeservers/{pxeServerUuid}

Headers

Authorization: OAuth the-session-uuid

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/clusters/42ade7c792e43f138f8b693294ad9b4c/pxeservers/2e9c8220a3ea3dbf9f8c3cb66567ff52

Request Parameters

Name Type Location Description Optional Value Starting Version
pxeServerUuid String url The UUID of the deployment server. 3.1.1
clusterUuid String url The UUID of the bare metal cluster. 3.1.1
systemTags List body Optional. The system tags. 3.1.1
userTags List body Optional. The user tags. 3.1.1

API Response

Sample Response

{
  "inventory": {
    "uuid": "bcd0703a8bbb394fa4e819ad90297b48",
    "name": "test",
    "hostname": "127.0.0.1",
    "sshUsername": "root",
    "sshPassword": "password",
    "sshPort": 22.0,
    "storagePath": "/zstack_bm_cache",
    "dhcpInterface": "eth0",
    "dhcpRangeBegin": "10.0.0.1",
    "dhcpRangeEnd": "10.0.0.255",
    "dhcpRangeNetmask": "255.255.255.0",
    "state": "Enabled",
    "status": "Disconnected"
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error 3.1.1
inventory BaremetalPxeServerInventory See inventory 3.1.1

#error

Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.1.1
description String The brief description of the error. 3.1.1
details String The details about the error. 3.1.1
elaboration String The reserved field. Default value: null. 3.1.1
opaque LinkedHashMap The reserved field. Default value: null. 3.1.1
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.1.1

#inventory

Name Type Description Starting Version
uuid String The UUID of the deployment server. 3.1.1
zoneUuid String The zone UUID. 3.1.1
name String The name of the deployment server. 3.1.1
description String The detailed description of the deployment server. 3.1.1
hostname String The IP address of the deployment server. 3.1.1
sshUsername String The SSH username of the deployment server. 3.1.1
sshPassword String The SSH password of the deployment server. 3.1.1
sshPort Integer The SSH port of the deployment server. 3.1.1
storagePath String The storage path of the deployment server. 3.1.1
dhcpInterface String The DHCP NIC of the deployment server. 3.1.1
dhcpRangeBegin String The starting IP address that DHCP assigns to a bare metal instance. 3.1.1
dhcpRangeEnd String The ending IP address that DHCP assigns to a bare metal instance. 3.1.1
dhcpRangeNetmask String The netmask of the IP range from which DHCP assigns an IP address to a bare metal instance. 3.1.1
state String The operating status of the deployment server. 3.1.1
status String The connection status of the deployment server. 3.1.1
createDate Timestamp The time when the deployment server was created. 3.1.1
lastOpDate Timestamp The time when the deployment server was last modified. 3.1.1
totalCapacity Long The total storage capacity in the specified storage path. 3.1.1
availableCapacity Long The available storage space in the specified storage path. 3.1.1
attachedClusterUuids List The UUIDs of the clusters to which the deployment server is attached. 3.1.1

SDK Sample

Java SDK

DetachBaremetalPxeServerFromClusterAction action = new DetachBaremetalPxeServerFromClusterAction();
action.pxeServerUuid = "2e9c8220a3ea3dbf9f8c3cb66567ff52";
action.clusterUuid = "42ade7c792e43f138f8b693294ad9b4c";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DetachBaremetalPxeServerFromClusterAction.Result res = action.call();

Python SDK

action = DetachBaremetalPxeServerFromClusterAction()
action.pxeServerUuid = "2e9c8220a3ea3dbf9f8c3cb66567ff52"
action.clusterUuid = "42ade7c792e43f138f8b693294ad9b4c"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()