阿里云如何使用更換系統(tǒng)盤接口
來源:技術(shù)員聯(lián)盟┆發(fā)布時間:2017-11-30 00:35┆點(diǎn)擊:
# 更換系統(tǒng)盤
描述
更換系統(tǒng)盤會改變這臺云服務(wù)器的系統(tǒng)盤的磁盤 ID。更換系統(tǒng)盤時,不改變系統(tǒng)盤的磁盤種類和付費(fèi)方式,同時原系統(tǒng)盤將被刪除;
更換系統(tǒng)盤時可以重新指定系統(tǒng)盤的容量大小(參數(shù)SystemDiskSize),SystemDisksSize必須大于等于max{40,更換前的系統(tǒng)盤容量};超過max{40,更換前的系統(tǒng)盤容量}的容量部分,將收取額外費(fèi)用;
實(shí)例的狀態(tài)必須為 Stopped 狀態(tài),且實(shí)例的 OperationLocks 中沒有標(biāo)記 "LockReason" : "security" 的鎖定狀態(tài),且不欠費(fèi);
請求參數(shù)
名稱
類型
是否必須
描述
Action
String
是
系統(tǒng)規(guī)定參數(shù),取值:ReplaceSystemDisk
InstanceId
String
是
指定實(shí)例的 ID
ImageId
String
是
重置系統(tǒng)時使用的鏡像 ID。
SystemDisk.Size
String
否
新的系統(tǒng)盤容量,以GB為單位,取值范圍為:min ~ 500;
min=Max{40,ImageId.size};
默認(rèn)值:min;
ClientToken
String
否
用于保證請求的冪等性。由客戶端生成該參數(shù)值,要保證在不同請求間唯一,最大不值過 64 個 ASCII 字符。
具體參見附錄:如何保證冪等性。
返回參數(shù)
名稱
類型
描述
DiskId
String
新系統(tǒng)盤的磁盤 ID
錯誤碼
錯誤代碼
描述
Http 狀態(tài)碼
語義
MissingParameter
The input parameter "InstanceId" that is mandatory for processing this request is not supplied.
400
InstanceId 參數(shù)未指定
MissingParameter
The input parameter "ImageId" that is mandatory for processing this request is not supplied.
400
ImageId 參數(shù)未指定
QuotaExceed.BuyImage
The specified image is from the image market,You have not bought it or your quota has been exceeded.
403
指定的鏡像來自鏡像市場,您沒有購買或者該鏡像在次地域的配額已用完
InvalidSystemDiskSize.LessThanImageSize
The specified parameter“SystemDisk.Size”is less than the image size
404
指定的 SystemDiskSize 小于鏡像的大小
InvalidSystemDiskSize.MoreThanMaxSize
The specified parameter "SystemDisk.Size" is more than the max size
404
指定的 SystemDiskSize 大于最大容量上限
InvalidSystemDiskSize.LessThanMinimumSize
The specified parameter"SystemDisk.Size" is less than the minimum size
404
指定的 SystemDiskSize 小于最小容量
InvalidInstanceId.NotFound
The specified instance does not exist.
404
指定的實(shí)例不存在
InvalidImageId.NotFound
The specified Image is disabled or is deleted.
404
指定的鏡像不存在
IncorrectInstanceStatus
The current status of the resource does not support this operation.
403
指定的實(shí)例狀態(tài)不正確
InstanceLockedForSecurity
The instance is locked due to security.
403
指定的實(shí)例被安全鎖定
ImageNotSubscribed
The specified image has not be subscribed.
403
指定的鏡像未在鏡像市場訂閱
ImageRemovedInMarket
The specified market image is not available, Or the specified user defined image includes product code because it is based on an image subscribed from marketplace, and that image in marketplace includeing exact the same product code has been removed.
403
指定的鏡像已經(jīng)從鏡像市場中下架
OperationDenied
Internal Error.
500
內(nèi)部錯誤
InvalidParameter.Conflict
The specified image does not support the specified instance type.
400
指定的鏡像不能在指定的實(shí)例規(guī)格上使用
InvalidInstanceId.NotFound
The InstanceId provided does not exist in our records.
404
指定的實(shí)例不存在
InstanceExpiredOrInArrears
The specified operation is denied as your prepay instance is expired (prepay mode) or in arrears (afterpay mode).
403
指定的實(shí)例已欠費(fèi)
ChargeTypeViolation
The operation is not permitted due to charge type of the instance.
403
指定實(shí)例的付費(fèi)方式不支持更換系統(tǒng)盤
DiskCreatingSnapshot
The operation is denied due to a snapshot of the specified disk is not completed yet.
403
指定的磁盤正在創(chuàng)建快照
IoOptimized.NotSupported
The specified image is not support IoOptimized Instance.
403
鏡像必須支持 IO 優(yōu)化實(shí)例
InvalidParameter.Conflict
The specified image does not support the specified instance type.
400
指定的鏡像不支持創(chuàng)建這一類規(guī)格的實(shí)例
示例
請求示例
https://ecs.aliyuncs.com/?Action=ReplaceSystemDisk
&InstanceId=i-23jggx34b
&ImageId=m-myimage11
&<公共請求參數(shù)>
返回示例
XML格式
d-23jbf2v5m
F3CD6886-D8D0-4FEE-B93E-1B73239673DE
JSON格式
{
"DiskId": "d-23jbf2v5m",
"RequestId": "F3CD6886-D8D0-4FEE-B93E-1B73239673DE"