Add KVM Host from Config File
Headers
Authorization: OAuth the-session-uuidBody
{
"params": {
"hostInfo": "FILE CONTENT ENCODE BY BASE64"
},
"systemTags": [],
"userTags": []
}In the above example, systemTags and userTags fields can be omitted. They are listed to indicate that these two 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":{"hostInfo":"FILE CONTENT ENCODE BY BASE64"}}' http://localhost:8080/zstack/v1/hosts/kvm/from-fileParameter List
| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| hostInfo | String | body (contained in params structure) | Host information encoded in base64 | 3.1.0 | |
| resourceUuid (optional) | String | body (contained in params structure) | 3.1.0 | ||
| systemTags (optional) | List | body | 3.1.0 | ||
| userTags (optional) | List | body | 3.1.0 |
API Response
Response Example
{
"results": [
{
"ip": "127.0.0.1",
"success": true
}
]
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | boolean | 3.1.0 | |
| error | ErrorCode | Error code. If not null, the operation failed. If null, the operation succeeded. See details error | 3.1.0 |
| results | List | See details results | 3.1.0 |
error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | Error code number, globally unique identifier of the error, e.g. SYS.1000, HOST.1001 | 3.1.0 |
| description | String | Brief description of the error | 3.1.0 |
| details | String | Detailed error information | 3.1.0 |
| elaboration | String | Reserved field, default is null | 3.1.0 |
| opaque | LinkedHashMap | Reserved field, default is null | 3.1.0 |
| cause | ErrorCode | Root cause, the error that caused the current error. If there is no original error, this field is null | 3.1.0 |
results
| Name | Type | Description | Starting Version |
|---|---|---|---|
| ip | String | Host IP | 3.1.0 |
| success | boolean | 3.1.0 | |
| error | ErrorCode | See details error | 3.1.0 |
error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | Error code number, globally unique identifier of the error, e.g. SYS.1000, HOST.1001 | 3.1.0 |
| description | String | Brief description of the error | 3.1.0 |
| details | String | Detailed error information | 3.1.0 |
| elaboration | String | Reserved field, default is null | 3.1.0 |
| opaque | LinkedHashMap | Reserved field, default is null | 3.1.0 |
| cause | ErrorCode | Root cause, the error that caused the current error. If there is no original error, this field is null | 3.1.0 |
SDK Examples
Java SDK
AddKVMHostFromConfigFileAction action = new AddKVMHostFromConfigFileAction();
action.hostInfo = "FILE CONTENT ENCODE BY BASE64";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AddKVMHostFromConfigFileAction.Result res = action.call();Python SDK
AddKVMHostFromConfigFileAction action = AddKVMHostFromConfigFileAction()
action.hostInfo = "FILE CONTENT ENCODE BY BASE64"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AddKVMHostFromConfigFileAction.Result res = action.call()