ReinstallInstance

1. API Description

This API is used to reinstall the operating system of the specified instance.

Prerequisites

Query image: call DescribeImages to check information on image.

Note

  • If you specify an imageId, the specified image is used. Otherwise, the image used by the current instance is used.

  • Operations on instances in recycle bin or in stalling status are not supported.

  • The system disk will be formatted and reset. Therefore, make sure that no important files are stored on the system disk.

  • If no password is specified, you will get a random password via mailbox.

  • The status of the instance will be INSTALLING during reinstallation. You can use DescribeInstances to query the status of the instance. If the status changes to Running, it means that the instance has been reinstalled successfully; INSTALL_FAILED means the instance has been reinstalled failed. Any operations on the instances are not allowed while creating. Please contact Zenlayer Support if you have failed.

2. Input Parameters

The following request parameter list only provides API request parameters.

Parameter NameRequiredTypeDescription

instanceId

Yes

String

Instance ID.

To obtain the instance ID, you can call DescribeInstances and look for instanceId in the response.

imageId

No

String

Valid image ID. To obtain valid image ID, you can call DescribeImages , 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. When using iPXE to install OS, pass the value of ipxeUrl, and leave imageId empty.

ipxeUrl

No

String

iPXE URL. Pass in the value and install your OS via IPMI.

You can choose to install OS using Netboot. See Deploy a Custom Image Using iPXE for more details.

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. You must and can only pass the value of either password or sshKeys.

sshKeys

No

Array of String

List of SSH keys.

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. You must and can only pass the value of either password or sshKeys.

raidConfig

No

Disk array configuration.

partitions

No

Array of Partition

Disk partition configuration. If the operating system is not installed, the partition cannot be set.

nic

No

NIC configuration.

3. Output Parameters

Parameter NameTypeDescription

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 /api/v2/bmc HTTP/1.1
Host: console.zenlayer.com
Content-Type: application/json
X-ZC-Action: ReinstallInstance
<Common Request Params>

Request:
{
    "instanceId": "instanceId"
}

Response:
{
  "requestId": "TC1748D3E-452D-4F74-8485-7AA73718E453",
  "response": {
    "requestId": "TC1748D3E-452D-4F74-8485-7AA73718E453"
  }

5. Developer Resources

Zenlayer Cloud API 2.0 integrates SDKs to make it easier for you to call APIs. More programming languages will be supported.

6. Error Codes

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.​

HTTP Status CodeError CodeDescription

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