Create PXE Server

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,
    "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 example above, systemTags and userTags fields can be omitted. They are listed to indicate that these fields can be included in the body.

Curl Example

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,"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

Parameter List

NameTypeLocationDescriptionAllowed ValuesStarting Version
nameStringbody(included in the params structure)Resource name 2.6.0
description (Optional)Stringbody(included in the params structure)Detailed description of the resource 2.6.0
dhcpInterfaceStringbody(included in the params structure)DHCP request listening NIC 2.6.0
dhcpRangeBegin (Optional)Stringbody(included in the params structure)DHCP address range start 2.6.0
dhcpRangeEnd (Optional)Stringbody(included in the params structure)DHCP address range end 2.6.0
dhcpRangeNetmask (Optional)Stringbody(included in the params structure)DHCP address range netmask 2.6.0
systemTags (Optional)ListbodySystem Tag 2.6.0
userTags (Optional)ListbodyUser Tag 2.6.0
zoneUuidStringbody(included in the params structure)Data Center UUID 0.6
hostnameStringbody(included in the params structure)  0.6
sshUsernameStringbody(included in the params structure)  0.6
sshPasswordStringbody(included in the params structure)  0.6
sshPort (Optional)Integerbody(included in the params structure)  0.6
storagePathStringbody(included in the params structure)  0.6
resourceUuid (Optional)Stringbody(included in the params structure)  0.6
tagUuids (Optional)Listbody(included in the params structure)Tag UUID list 3.4.0

API Response

Response Example

{
  "inventory": {
    "uuid": "e958961c7785304691d49ec5ac7df64d",
    "name": "test",
    "hostname": "127.0.0.1",
    "sshUsername": "root",
    "sshPassword": "password",
    "sshPort": 22,
    "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"
  }
}
NameTypeDescriptionStarting Version
successboolean 0.6
errorErrorCodeError code. If not null, the operation failed. When the operation is successful, this field is null. For details, see error2.6.0
inventoryBaremetalPxeServerInventoryFor details, see inventory2.6.0

error

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

inventory

NameTypeDescriptionStarting Version
uuidStringUUID of the resource, uniquely identifying the resource3.1.1
zoneUuidStringData Center UUID3.1.1
nameStringResource name3.1.1
descriptionStringDetailed description of the resource3.1.1
hostnameStringDeployment server address3.1.1
sshUsernameStringDeployment server SSH account3.1.1
sshPasswordStringDeployment server SSH password3.1.1
sshPortIntegerDeployment server SSH port3.1.1
storagePathStringDeployment server storage path3.1.1
dhcpInterfaceStringDHCP request listening NIC3.1.1
dhcpInterfaceAddressStringDHCP request listening NIC IP address3.1.1
dhcpRangeBeginStringDHCP address range start3.1.1
dhcpRangeEndStringDHCP address range end3.1.1
dhcpRangeNetmaskStringDHCP subnet mask3.1.1
stateStringDeployment server running state3.1.1
statusStringDeployment server connection status3.1.1
createDateTimestampCreate time3.1.1
lastOpDateTimestampLast modification time3.1.1
totalCapacityLongStorage path total capacity3.1.1
availableCapacityLongStorage path available capacity3.1.1
attachedClusterUuidsListDeployment server attached cluster UUID list3.1.1

SDK Examples

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