class documentation

Attach a managed disk.

Lifecycle:

  • The disk is deleted when the instance is deleted.

Semantics:

  • Specifying a ManagedDisk expresses an intent to have that managed disk attached.
  • If this intent cannot be satisfied, the entire operation fails.
  • You can check the intent status in instance.status.disk_attachments.

Updates and matching:

  • Managed disks can be updated only via instance spec updates. Updates via DiskService are not allowed.
  • During updates, disks are matched by name.

Renaming and data loss:

  • Changing the disk name triggers disk replacement (create a new disk and delete the old one), which causes data loss.
  • To rename a managed disk safely:
    1. switch it to ExistingDisk in the instance spec, and
    2. update/rename it via DiskService.

Conflicts:

  • Instance create/update fails if there is already a disk with the same name. as requested by any ManagedDisk.

Finding the disk ID:

  • The disk ID is available in instance.status.disk_attachments after it is created. Use DiskAttachmentStatus.name to find the desired disk which matches name.

Switching to an existing (non-managed) disk:

  • To preserve the disk after instance deletion, switch it to ExistingDisk in the instance spec, use the disk ID from instance.status.disk_attachments.

Deletion protection:

  • Switching ExistingDisk to ManagedDisk fails if Disk.spec.deletion_protection is enabled.
  • Deleting an instance that has a ManagedDisk fails if Disk.spec.deletion_protection is enabled.
Class Variable field Undocumented
Property value Attach a managed disk.

Inherited from __OneOfClass_type__:

Class Variable name Undocumented

Inherited from OneOf (via __OneOfClass_type__):

Method __init__ Undocumented
Instance Variable _message Undocumented
field: Literal[managed_disk] = (source)

Undocumented

Attach a managed disk.

Lifecycle:

  • The disk is deleted when the instance is deleted.

Semantics:

  • Specifying a ManagedDisk expresses an intent to have that managed disk attached.
  • If this intent cannot be satisfied, the entire operation fails.
  • You can check the intent status in instance.status.disk_attachments.

Updates and matching:

  • Managed disks can be updated only via instance spec updates. Updates via DiskService are not allowed.
  • During updates, disks are matched by name.

Renaming and data loss:

  • Changing the disk name triggers disk replacement (create a new disk and delete the old one), which causes data loss.
  • To rename a managed disk safely:
    1. switch it to ExistingDisk in the instance spec, and
    2. update/rename it via DiskService.

Conflicts:

  • Instance create/update fails if there is already a disk with the same name. as requested by any ManagedDisk.

Finding the disk ID:

  • The disk ID is available in instance.status.disk_attachments after it is created. Use DiskAttachmentStatus.name to find the desired disk which matches name.

Switching to an existing (non-managed) disk:

  • To preserve the disk after instance deletion, switch it to ExistingDisk in the instance spec, use the disk ID from instance.status.disk_attachments.

Deletion protection:

  • Switching ExistingDisk to ManagedDisk fails if Disk.spec.deletion_protection is enabled.
  • Deleting an instance that has a ManagedDisk fails if Disk.spec.deletion_protection is enabled.