AddKVMHost
API Request
URLs
POST zstack/v1/hosts/kvmHeaders
Authorization: OAuth the-session-uuidBody
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.
{
"params": {
"username": "userName",
"password": "password",
"sshPort": 22,
"name": "newHost",
"managementIp": "127.0.0.1",
"clusterUuid": "449c63f16f9144528d99315f903be36e"
},
"systemTags": [],
"userTags": []
}
Note: 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":{"username":"userName","password":"password","sshPort":"22","name":"newHost","managementIp":"127.0.0.1","clusterUuid":"9adf394ca46432afb1218d220bf2925e"}}' \
http://localhost:8080/zstack/v1/hosts/kvmRequest Parameters
Note:
| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| username | String | body (contained in the params structure) | The SSH username. | 0.6 | |
| password | String | body (contained in the params structure) | The SSH password. | 0.6 | |
| sshPort | int | body (contained in the params structure) | Optional. The SSH port No. | 0.6 | |
| name | String | body (contained in the params structure) | The resource name. | 0.6 | |
| description | String | body (contained in the params structure) | Optional. The detailed description of the resource. | 0.6 | |
| managementIp | String | body (contained in the params structure) | The host management address. IPv4 addresses, IPv6 addresses, and DNS names are supported. | 0.6 | |
| clusterUuid | String | body (contained in the params structure) | The cluster UUID. | 0.6 | |
| resourceUuid | String | body (contained in the params structure) | Optional. The resource UUID. | 0.6 | |
| systemTags | List | body | Optional. The system tags. | 0.6 | |
| userTags | List | body | Optional. The user tags. | 0.6 |
Note:
- When you create a KVM host in ZStack Cloud, you can disable EPT by adding the
disable EPT option to SystemTags.
- Format of the disable EPT option:
pageTableExtensionDisabled - Example:
pageTableExtensionDisabled
- Format of the disable EPT option:
API Response
Sample
Response
{
"inventory": {
"zoneUuid": "d4160c59319c4642832e666514364a79",
"name": "example",
"uuid": "479e88bab7a647e3b066a724c8bb3b82",
"clusterUuid": "42ade59801804602b9986b42fd103d1c",
"description": "example",
"managementIp": "192.168.0.1",
"hypervisorType": "KVM",
"state": "Enabled",
"status": "Connected",
"totalCpuCapacity": 4.0,
"availableCpuCapacity": 2.0,
"totalMemoryCapacity": 4.0,
"availableMemoryCapacity": 4.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. | 0.6 |
| inventory | HostInventory | Seeinventory. | 0.6 |
#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. | 0.6 |
| description | String | The brief description of the error. | 0.6 |
| details | String | The details about the error. | 0.6 |
| elaboration | String | The reserved field. Default value: null. | 0.6 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 0.6 |
| cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 0.6 |
#inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| zoneUuid | String | The zone UUID. | 0.6 |
| name | String | The resource name. | 0.6 |
| uuid | String | The resource UUID. | 0.6 |
| clusterUuid | String | The cluster UUID. | 0.6 |
| description | String | The detailed description of the resource. | 0.6 |
| managementIp | String | 0.6 | |
| hypervisorType | String | 0.6 | |
| state | String | 0.6 | |
| status | String | 0.6 | |
| totalCpuCapacity | Long | 0.6 | |
| availableCpuCapacity | Long | 0.6 | |
| cpuSockets | Integer | 0.6 | |
| totalMemoryCapacity | Long | 0.6 | |
| availableMemoryCapacity | Long | 0.6 | |
| cpuNum | Integer | 0.6 | |
| createDate | Timestamp | The creation date. | 0.6 |
| lastOpDate | Timestamp | The last operation date. | 0.6 |
SDK Sample
Java
SDK
AddKVMHostAction action = new AddKVMHostAction();
action.username = "userName";
action.password = "password";
action.sshPort = 22;
action.name = "newHost";
action.managementIp = "127.0.0.1";
action.clusterUuid = "03de4c2f2b5445b7a3ab5ba44930c4e8";
action.sessionId = "5354944d50634bed8088567b5d551e6f";
AddKVMHostAction.Result res = action.call();Python
SDK
AddKVMHostAction action = AddKVMHostAction()
action.username = "userName"
action.password = "password"
action.sshPort = 22
action.name = "newHost"
action.managementIp = "127.0.0.1"
action.clusterUuid = "9fa355cc5434466cba6fb478b8559dad"
action.sessionId = "d3770b6e43874065a1ff3cf127857e32"
AddKVMHostAction.Result res = action.call()