ReInitDisk - 初始化磁盘至创建时的初始状态

更新时间:
复制 MD 格式

重新初始化一块磁盘至创建时的初始状态。

接口说明

调用该接口时,您需要注意:

  • 磁盘的状态必须为使用中In_use),云盘挂载的 ECS 实例的状态必须为已停止Stopped)。

  • 实例首次启动前,不能重新初始化挂载在其上的磁盘。

  • 已存在本地快照的云盘,不能重新初始化。

  • 开启多重挂载特性的云盘,不能重新初始化。

  • 对于系统盘,初始化到镜像的最初状态。若创建云盘的源镜像被删除,则无法初始化。

  • 对于直接创建的数据盘,初始化到空盘状态;对于通过快照创建的数据盘,初始化到快照状态。若源快照已被删除,则无法初始化并返回错误。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

调试

授权信息

下表是API对应的授权信息,可以在RAM权限策略语句的Action元素中使用,用来给RAM用户或RAM角色授予调用此API的权限。具体说明如下:

  • 操作:是指具体的权限点。

  • 访问级别:是指每个操作的访问级别,取值为写入(Write)、读取(Read)或列出(List)。

  • 资源类型:是指操作中支持授权的资源类型。具体说明如下:

    • 对于必选的资源类型,用前面加 * 表示。

    • 对于不支持资源级授权的操作,用全部资源表示。

  • 条件关键字:是指云产品自身定义的条件关键字。

  • 关联操作:是指成功执行操作所需要的其他权限。操作者必须同时具备关联操作的权限,操作才能成功。

操作

访问级别

资源类型

条件关键字

关联操作

ecs:ReInitDisk

update

*Disk

acs:ecs:{#regionId}:{#accountId}:disk/{#diskId}

  • ecs:PasswordCustomized

请求参数

名称

类型

必填

描述

示例值

DiskId

string

待初始化的磁盘 ID。

d-bp67acfmxazb4ph****

Password

string

重新初始化系统盘时,是否重置 ECS 实例的用户名密码。长度为 8 至 30 个字符,必须同时包含大小写英文字母、数字和特殊符号中的三类字符。特殊符号可以是:

()`~!@#$%^&*-_+=|{}[]:;'<>,.?/

其中,Windows 实例不能以斜线号(/)为密码首字符。

说明

如果传入Password参数,建议您使用 HTTPS 协议发送请求,避免密码泄露。

EcsV587!

KeyPairName

string

密钥对名称。

说明

该参数仅适用于 Linux 实例。重新初始化系统盘时,您可以为 ECS 实例绑定一个 SSH 密钥对,作为登录凭证。使用了 SSH 密钥对后,用户名密码的登录凭证方式将被禁用。

testKeyPairName

AutoStartInstance

boolean

重新初始化磁盘后,是否自动启动实例。取值范围:

  • true:是,自动启动实例。

  • false:否。

默认值:false。

true

SecurityEnhancementStrategy

string

当指定的云盘为系统盘时,重新初始化云盘后是否免费使用云安全中心服务。取值范围:

  • Active:使用。该值仅支持公共镜像。

  • Deactive:不使用。该值支持所有镜像。

默认值:Deactive。

Active

返回参数

名称

类型

描述

示例值

object

RequestId

string

请求 ID。

473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

示例

正常返回示例

JSON格式

{
  "RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
}

异常返回示例

JSON格式

{
    "RequestId":"F3CD6886-D8D0-4FEE-B93E-1B73239673DE"
}

错误码

HTTP status code

错误码

错误信息

描述

400 LoginAsNonRoot.ImageNotSupport The specified image does not support login as non-root. 此镜像不支持NonRoot登录。
400 DiskHasSnapshotsWithInstantAccessEnabled.OperationNotSupported The operation is not supported to the specified disk that have snapshots with InstantAccess enabled.
400 InvalidPassword.Malformed The specified parameter "Password" is not valid. 指定的参数 Password 不合法
400 InvalidKeyPairName.NotFound The specified KeyPairName does not exist. 指定的 KeyPairName 不存在。
400 DependencyViolation.IoOptimize The specified parameter InstanceId is not valid. 指定的实例 IO 优化配置不合法。
400 DiskCategory.OperationNotSupported The operation is not supported to the specified disk due to its disk category. 由于磁盘种类限制,指定的磁盘不支持该操作。
400 InvalidRegionId.MalFormed The specified RegionId is not valid.
500 InternalError The request processing has failed due to some unknown error, exception or failure. 内部错误,请重试。
403 LoginAsNonRoot.RegionNotSupport The specified region does not support login as non-root.
403 IncorrectDiskStatus The current disk status does not support this operation.
403 IncorrectInstanceStatus The current status of the resource does not support this operation.
403 InstanceLockedForSecurity The instance is locked due to security. 您的资源被安全锁定,拒绝操作。
403 InvalidSnapshot.TooOld The disk is created from a snapshotId made before 2013-07-15, it cannot be re-initiated the specified disk any more since the detached first time. 创建于2013715日之前的快照不支持此操作。
403 OperationDenied The snapshot which is used to create the specified disk has been deleted.
403 InstanceExpiredOrInArrears The specified operation is denied as your prepay instance is expired (prepay mode) or in arrears (afterpay mode).
403 DiskCreatingSnapshot The operation is denied due to a snapshot of the specified disk is not completed yet.
403 SharedImageDeleted The specified image by others shared is deleted.
403 DependencyViolation.WindowsInstance The instance creating is windows, cannot use ssh key pair to login.
403 InvalidDisk.DiskFromClonedNotSupport The specified disk %s is cloned from source disk %s, so not support reinit
403 UserNotInTheWhiteList The user is not in volume white list.
403 InvalidParameter.KMSKeyId.CMKNotEnabled The CMK needs to be enabled.
403 InvalidParameter.KMSKeyId.KMSUnauthorized ECS service have no right to access your KMS. ECS 服务无权访问您的 KMS。
403 HibernationConfigured.InstanceOperationForbidden The operation is not permitted due to limit of the hibernation configured instance. 不符合开启休眠选项的实例的相关限制,操作不被允许。
403 InvalidOperation.MultiAttachDisk Multi attach disk does not support this operation. 开启多重挂载特性的云盘不支持该操作。
403 InvalidParameter.KMSKeyId.CMKUnauthorized The CMK needs to be added ECS tag. CMK 未授权
403 InvalidSourceSnapshot The source snapshot of the disk has been deleted and cannot support the current operation. 磁盘的源快照已经被删除,无法支持当前操作。
403 InvalidOperation.ReInitUnsupported The specified disk does not support reInit. 指定云盘不支持重新初始化。
404 InvalidDiskId.NotFound The specified disk does not exist. 指定的磁盘不存在。请您检查磁盘 ID 是否正确。
404 InvalidImageId.NotFound The specified ImageId does not exist. 指定的镜像在该用户账号下不存在,请您检查镜像 ID 是否正确。
404 InvalidDiskId.OperationNotSupported The operation is not supported due to image not exist. 指定的镜像不存在。

访问错误中心查看更多错误码。

变更历史

更多信息,参考变更详情