ReinstallServer
1. API Description
This API is used to reinstall the operating system of the specified instance.
Prerequisites
Query image: call ImageList to check information on image.
2. Input Parameters
The following request parameter list only provides API request parameters.
instanceId
Yes
String
Instance ID.
To obtain the instance ID, you can call InstanceDetails and look for instanceId in the response.
imageId
No
String
Valid image ID.
To obtain valid image ID, you can call ImageList , pass in instanceTypeId to retrieve the list of images supported by the current model, and then find the imageId in the response.
You can also not specify an image and install it later through IPMI.
hostname
No
String
Instance hostname.
Default value: hostname.
This parameter can contain up to 64 . characters. Only letters, numbers, - and periods (.) are supported.
password
No
String
Instance password.
The parameter must be 8-16 characters, including uppercase letters, lowercase letters, numbers and special characters like 1~!@$^*-_=+. This password is also used as the password for IPMI login. Please keep it safe.
If no password is specified and sshKeys is not set, the system will generate a random password and send it to the creator's mailbox after the instance is successfully created.
sshKeys
No
Array of String
List of SSH keys.
sshKeys and password cannot be specified at the same time. If an SSH key is used to log in, password login will be disabled. Up to 5 keys are supported.
Note:
For instances of Windows and EXSi operating systems, ignore this parameter. Default value is empty. Even if this parameter is filled in, only the value of password will be passed in.
If imageId is not specified, then sshKeys will be ignored.
partitions
No
Array of Partition
Disk partition configuration. If the operating system is not installed, the partition cannot be set.
3. Output Parameters
requestId
String
The unique request ID, which is returned for each request. RequestId is required for locating a problem.
4. Code Example
Default reinstallation
Reinstall the operating system of the instance of the instanceId ID with default value.
POST / HTTP/1.1
Host: console.harmonynetworks.net/api/v2/bmc
Content-Type: application/json
X-ZC-Action: ReinstallServer
<Common Request Params>
Request:
{
"instanceId": "instanceId"
}
Response:
{
"requestId": "TC1748D3E-452D-4F74-8485-7AA73718E453",
"response": {
"requestId": "TC1748D3E-452D-4F74-8485-7AA73718E453"
}
Custom reinstallation
Reinstall the operating system of the instance of the instanceId ID, image ID: bd5faa16-39d2-4bbf-a5c8-b95a193b1626, hostname: myhostname, password: Aa_12345, disk array: raid0, two partitions, public NIC name: wan0, and private NIC name: lan0.
POST / HTTP/1.1
Host: console.harmonynetworks.net/api/v2/bmc
Content-Type: application/json
X-TC-Action: ReinstallServer
<Common Request Params>
Request:
{
"instanceId": "instanceId",
"imageId": "bd5faa16-39d2-4bbf-a5c8-b95a193b1626",
"hostname": "myhostname",
"password": "Aa_12345"
"raidConfig": {
raidType": 0
},
"partitions": [
{
"fsPath": "/",
"fsType": "ext2",
"size": 1100
},
{
"fsPath": "/a",
"fsType": "ext2",
"size": 1100
}
],
"nic": {
"wanName": "wan0",
"lanName": "lan0"
}
}
Response:
{
"requestId": "TC1748D3E-452D-4F74-8485-7AA73718E453",
"response": {
"requestId": "TC1748D3E-452D-4F74-8485-7AA73718E453"
}
}5. Error Codes
The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.
400
INVALID_PARAMETER_HOSTNAME_EXCEED
Invalid hostname length. The specified hostname exceeds the maximum length.
400
INVALID_PARAMETER_HOSTNAME_MALFORMED
Invalid hostname format.
400
INVALID_PARAMETER_INSTANCE_NAME_EXCEED
Invalid instance name length. The specified instance name exceeds the maximum length.
400
INVALID_PARAMETER_INSTANCE_NAME_EXCEED
Invalid instance name format.
404
INVALID_INSTANCE_NOT_FOUND
Instance not found.
404
INVALID_IMAGE_NOT_FOUND
Image not found.
403
INVALID_PARTITION_IMAGE_NOT_SET
Custom partition are only supported for specific operating system.
400
INVALID_PARAMETER_VALUE_PASSWORD_MALFORMED
Invalid password.
400
INVALID_PARAMETER_INSTANCE_LOGIN_CONFLICT
Password login and SSH key login cannot be specified at the same time.
400
INVALID_PARAMETER_SSH_KEY_MALFORMED
Invalid SSH key format. Usually start with rsa.
400
INVALID_RAID_CONFIG_FAST_CUSTOM_CONFLICT
Custom RAID and rapid RAID cannot be specified at the same time.
400
INVALID_INSTANCE_TYPE_RAID_NOT_SUPPORT
RAID level not supported for current instance model.
400
INVALID_PARAMETER_NIC_NAME_CONFLICT
Public NIC name and private NIC name cannot be the same.
400
INVALID_PARAMETER_NIC_NAME_MALFORMED
Invalid public or private NIC name.
400
INVALID_PARTITION_SIZE_NOT_FULL
Invalid partition size. Does not reach the specified capacity.
400
INVALID_PARTITION_DUPLICATE_FILE_PATH
Duplicated file path or drive letters of the partition.
400
INVALID_PARTITION_MISSING_REQUIRED_FILE_PATH
File path (drive letter) is needed.
"c" must be included for Windows, and "/" must be included for Linux.
400
INVALID_PARTITION_MALFORMED
Invalid file type or path format.
400
INVALID_PARTITION_NO_TYPE
Invalid file type.
400
INVALID_PARTITION_INVALID_ORDER
Drive letters must be filled in alphabetical order, such as CDEFG for Windows.
400
INVALID_PARAMETER_VALUE_RAID_DISK_MISMATCH
Disk quantity does not meet the RAID level requirement in custom RAID configuration.
400
INVALID_PARAMETER_VALUE_RAID_DISK_DISORDER
Serial numbers of disks must be filled in order, such as [1,2,3], in custom RAID configuration.
400
INVALID_INSTANCE_TYPE_QUICK_RAID_NOT_SUPPORT
Rapid RAID not supported. Please customize RAID settings.
Last updated