Attache un disque de données ou un disque système à une instance ECS.
Description de l'opération
Lorsque vous appelez cette opération, prenez note des éléments suivants :
-
L'instance et le disque doivent se trouver dans la même zone.
-
Le disque doit être dans l'état Available (Available).
-
Lorsque vous attachez un disque de données :
L'instance ECS de destination doit être dans l'état Running (Running) ou Stopped (Stopped).
Si le disque est acheté séparément, le mode de facturation doit être à l'usage.
Un disque système qui a été désinstallé d'une instance ECS peut être attaché en tant que disque de données sans restriction de mode de facturation.
Un disque éphémère élastique qui a été détaché ne peut être rattaché qu'à son instance d'origine.
-
Lorsque vous attachez un disque système :
L'instance ECS de destination doit être l'instance d'origine de laquelle le disque système a été détaché.
L'instance ECS de destination doit être dans l'état Stopped (Stopped).
Vous devez spécifier les informations d'identification de connexion pour l'instance.
Les disques éphémères élastiques ne peuvent pas être attachés en tant que disques système.
Pour plus d'informations sur l'attachement des disques système, consultez Détacher ou attacher un disque système.
-
Lorsque vous interrogez les informations de l'instance ECS, si la réponse contient
{"OperationLocks": {"LockReason" : "security"}}, toutes les opérations sont interdites.
Testez maintenant
Testez cette API dans OpenAPI Explorer, sans signature manuelle. Les appels réussis génèrent automatiquement du code SDK correspondant à vos paramètres. Téléchargez-le avec une sécurité intégrée des identifiants pour une utilisation locale. Testez cette API dans OpenAPI Explorer, sans signature manuelle. Les appels réussis génèrent automatiquement du code SDK correspondant à vos paramètres. Téléchargez-le avec une sécurité intégrée des identifiants pour une utilisation locale.
Test
Autorisation RAM
|
ecs:AttachDisk |
update |
*Disk
*Instance
|
|
Aucune |
Paramètres de requête
|
Paramètre |
Type |
Requis |
Description |
Exemple |
| InstanceId |
string |
Oui |
L'identifiant de l'instance ECS à laquelle vous souhaitez attacher le disque. |
i-bp1dq5lozx5f4pmd**** |
| DiskId |
string |
Oui |
L'identifiant du disque à attacher. Le disque (DiskId) et l'instance (InstanceId) doivent se trouver dans la même zone. Remarque
Vous pouvez attacher des disques de données et des disques système. Pour les contraintes associées, consultez la section de description de l'opération ci-dessus. |
d-bp1j4l5axzdy6ftk**** |
| Device |
string |
Non |
Le nom de périphérique du disque. Remarque
Ce paramètre sera bientôt obsolète. Pour améliorer la compatibilité, utilisez d'autres paramètres pour identifier le disque. |
testDeviceName |
| DeleteWithInstance |
boolean |
Non |
Indique si le disque doit être libéré lorsque l'instance est libérée. Valeurs valides :
Valeur par défaut : false. Prenez note des éléments suivants lorsque vous définissez ce paramètre :
|
false |
| Bootable |
boolean |
Non |
Indique si le disque doit être attaché en tant que disque système. Valeurs valides :
Valeur par défaut : false. Remarque
Si vous définissez Bootable=true, l'instance ECS de destination ne doit avoir aucun disque système attaché. |
false |
| Password |
string |
Non |
Le mot de passe défini pour l'instance lorsque vous attachez un disque système. Le mot de passe n'est effectif que pour les noms d'utilisateur administrator et root, et n'est pas effectif pour les autres noms d'utilisateur. Le mot de passe doit comporter entre 8 et 30 caractères et doit contenir au moins trois des types de caractères suivants : lettres majuscules, lettres minuscules, chiffres et caractères spéciaux. Les caractères spéciaux suivants sont pris en charge :
Pour les instances Windows, le mot de passe ne peut pas commencer par une barre oblique (/). Remarque
Si vous spécifiez le paramètre Password, envoyez la requête via HTTPS pour éviter les fuites de mot de passe. |
EcsV587! |
| KeyPairName |
string |
Non |
Le nom de la paire de clés SSH liée à l'instance ECS Linux lorsque vous attachez un disque système.
|
KeyPairTestName |
| Force |
boolean |
Non |
Indique si le disque doit être attaché de force. Valeurs valides :
Valeur par défaut : false. Remarque
Actuellement, seuls les ESSD régionaux (cloud_regional_disk_auto) prennent en charge la définition de ce paramètre sur true. |
false |
Éléments de réponse
|
Élément |
Type |
Description |
Exemple |
|
object |
|||
| RequestId |
string |
L'identifiant de la requête. |
473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E |
Exemples
JSON format
{
"RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
}
Codes d'erreur
|
Code de statut HTTP |
Code d'erreur |
Message d'erreur |
Description |
|---|---|---|---|
| 400 | InvalidDevice.Malformed | The specified device is not valid. | |
| 400 | IncorrectInstanceStatus | The current status of the resource does not support this operation. | |
| 400 | InvalidParameter | The input parameter is mandatory for processing this request is empty. | |
| 400 | InvalidRegionId.MalFormed | The specified RegionId is not valid. | |
| 400 | InvalidOperation.InstanceTypeNotSupport | The instance type of the specified instance does not support hot attach disk. | |
| 400 | DiskCategory.OperationNotSupported | The operation is not supported to the specified disk due to its disk category. | |
| 400 | InvalidDisk.DiskNotBootable | The specified disk is not a bootable disk. It cannot be attached as a system disk. | |
| 400 | InvalidInstance.NotOriginInstance | The specified disk can not attached to other instance as system disk. | |
| 400 | InvalidParameterForce.DiskCategoryNotSupported | The specified disk category does not support force attach operation. | |
| 400 | InvalidParameterForce.PrepaidDiskNotSupported | The prepaid disk does not support force attach operation. | |
| 400 | InvalidParameterForce.MultiAttachDiskNotSupported | The multi attach disk does not support force attach operation. | |
| 400 | InvalidParameterForce.RegionNotSupported | The specified region does not support force attach operation. | |
| 400 | OperationConflict.DisksAttachingParallellyExceed | The number of disks attaching parallelly exceeds the limit. | |
| 400 | InvalidInstanceType.NotSupported | The specified instanceType is not supported by the image architecture. | |
| 400 | InvalidOperation.EncryptedDiskUnsupported | The specified encrypted disk is not supported for this operation. | |
| 500 | InternalError | The request processing has failed due to an internal error and you may retry later or contact support with the request ID. | |
| 403 | InstanceDiskLimitExceeded | The number of disks attached to the instance has exceeded the limit. | |
| 403 | InvalidDevice.InUse | The specified device has been occupied. | |
| 403 | DiskNotPortable | The specified disk is not a portable disk. | |
| 403 | InstanceLockedForSecurity | The instance is locked due to security. | |
| 403 | ResourcesNotInSameZone | The specified instance and disk are not in the same zone. | |
| 403 | InstanceExpiredOrInArrears | The specified operation is denied as your prepay instance is expired (prepay mode) or in arrears (afterpay mode). | |
| 403 | DiskInArrears | The specified operation is denied because the disk has overdue payments. Please settle the outstanding balance. | |
| 403 | DiskError | IncorrectDiskStatus. | |
| 403 | DiskId.ValueNotSupported | The specified parameter diskid is not supported. | |
| 403 | DiskId.StatusNotSupported | The specified disk status is not supported. | |
| 403 | IncorrectInstanceStatus.NotSupportESSD | The operation is not supported in this status. Please reboot the instance. | |
| 403 | IncorrectDiskStatus | The operation is not supported in this status. | |
| 403 | UserNotInTheWhiteList | The user is not in disk white list. | |
| 403 | InvalidParameter.KMSKeyId.CMKNotEnabled | The CMK needs to be enabled. | |
| 403 | InvalidParameter.KMSKeyId.CMKUnauthorized | The CMK has not authorized the ECS service to perform the KMS TagResource and UntagResource operations. Please verify the authorization and try again. | |
| 403 | InvalidParameter.KMSKeyId.KMSUnauthorized | ECS service does not have permission to access your KMS key. Please verify that the specified KMS key has authorized the ECS service. | |
| 403 | DependencyViolation.WindowsInstance | The instance image is Windows. SSH key pair login is not supported. | |
| 403 | InvalidInstanceType.NotSupportDiskCategory | The instanceType of the specified instance does not support this disk category. | |
| 403 | InvalidInstanceType.NotSupportPL0 | The instanceType of the specified instance does not support PL0 of cloud_essd. | |
| 403 | InvalidInstanceType.NvmeRequired | The instanceType of the specified instance requires nvme protocol. | |
| 403 | InvalidInstanceType.NvmeUnsupported | The instanceType of the specified instance does not support nvme protocol. | |
| 403 | InvalidInstanceType.NotSupportMultiAttachDisk | The instanceType of the specified instance does not support multi attach disk. | |
| 403 | DiskAttachedNumberExceeded | The attaching times of the specified disk exceeded. | |
| 403 | InvalidOperation.CanNotAttachMultiAttachDiskAsSystemDisk | Multi attach disk can not be attached as system disk. | |
| 403 | DeleteWithInstance.Conflict | Multi attach disk cannot be set to DeleteWithInstance attribute. | |
| 403 | InvalidParameter.DeleteWithInstance | The DeleteWithInstance for the elastic ephemeral disk must be set to true. | |
| 403 | InvalidOperation.OtherInstanceUnsupported | The elastic ephemeral disk can only be attached to the instance it was last mounted on. Please check the disk system tag to get the last associated instance. | |
| 403 | InvalidInstance.ZoneConflict | The force attach operation is not supported when both the current and target instances are in the same zone. | |
| 403 | InvalidParameter.AllEmpty | The current operation requires either a password or a keyPairName to must be provided. Please ensure that at least one of them is not empty. | |
| 403 | InvalidOperation.DiskQueueNumberNotEnough | The number of disk queues on the instance is not enough. | |
| 403 | InvalidOperation.DiskAttachModeUnsupported | The instance type does not support the disk attach mode. | |
| 403 | OperationDenied.HpnZoneMismatch | Instance and disk must be in the same HPN zone for restricted HPN zones. | |
| 403 | OperationDenied.UnsupportedEncryptedDisk | The instance type does not support attaching encrypted disks. | |
| 404 | InvalidInstanceId.NotFound | The specified InstanceId does not exist. | |
| 404 | InvalidDiskId.NotFound | The specified disk does not exist. | |
| 404 | InvalidDisk.InUse | The specified disk has been occupied. | |
| 404 | DiskAttachedNumberExceeded | The attaching times of the specified disk exceeded. | |
| 404 | InvalidKMSKeyId.NotFound | The KMS key used by the disk does not exist. |
Consultez Codes d'erreur pour la liste complète.
Notes de version
Consultez Notes de version pour la liste complète.