class documentation
class AttachedDiskSpec(pb_classes.Message): (source)
Constructor: AttachedDiskSpec(initial_message, attach_mode, existing_disk, managed_disk, ...)
Undocumented
| Class | __ |
Undocumented |
| Class | __ |
Undocumented |
| Class | __ |
Undocumented |
| Class | |
Undocumented |
| Method | __dir__ |
Undocumented |
| Method | __init__ |
Create a wrapper around a protobuf message instance. |
| Method | attach |
Undocumented |
| Method | device |
Undocumented |
| Method | existing |
Undocumented |
| Method | managed |
Undocumented |
| Constant | __PB2 |
Undocumented |
| Constant | __PY |
Undocumented |
| Class Variable | __mask |
Undocumented |
| Property | attach |
Undocumented |
| Property | device |
Specifies the user-defined identifier, allowing to use '/dev/disk/by-id/virtio-{device_id}' as a device path in mount command. |
| Property | existing |
Attach an existing disk. |
| Property | managed |
Attach a managed disk. |
| Property | type |
Undocumented |
Inherited from Message:
| Class Method | get |
Return the protobuf descriptor for this message class. |
| Class Method | is |
Return True if the field contains credentials. |
| Class Method | is |
Return True if the field is marked as sensitive. |
| Method | __repr__ |
Return a human-readable representation of the message, sanitizing sensitive fields. |
| Method | check |
Check explicit presence for a field in the protobuf message. |
| Method | get |
Build a reset mask for a full update of this message. |
| Method | get |
Return the tracked reset mask. |
| Method | is |
Return True if a field equals its default value. |
| Method | set |
Replace the tracked reset mask. |
| Method | which |
Return the set field name for a given oneof. |
| Instance Variable | __PB2 |
Protobuf message class associated with this wrapper. |
| Instance Variable | __pb2 |
Underlying protobuf message instance. |
| Method | _clear |
Clear a field and record it in the reset mask. |
| Method | _get |
Return a field value with optional wrapping and presence handling. |
| Method | _set |
Set a field value and update the reset mask. |
| Class Variable | __credentials |
Undocumented |
| Class Variable | __default |
Undocumented |
| Class Variable | __sensitive |
Undocumented |
| Instance Variable | __recorded |
Mask tracking fields cleared or set to default. |
def __init__(self, initial_message:
message_1.Message | None = None, *, attach_mode: AttachedDiskSpec.AttachMode | instance_pb2.AttachedDiskSpec.AttachMode | None | unset.UnsetType = unset.Unset, existing_disk: ExistingDisk | instance_pb2.ExistingDisk | None | unset.UnsetType = unset.Unset, managed_disk: ManagedDisk | instance_pb2.ManagedDisk | None | unset.UnsetType = unset.Unset, device_id: builtins.str | None | unset.UnsetType = unset.Unset):
(source)
¶
Create a wrapper around a protobuf message instance.
| Raises | |
AttributeError | If the wrapper is missing required class metadata. |
@attach_mode.setter
def attach_mode(self, value:
def attach_mode(self, value:
AttachedDiskSpec.AttachMode | instance_pb2.AttachedDiskSpec.AttachMode | None):
(source)
¶
Undocumented
@existing_disk.setter
def existing_disk(self, value:
def existing_disk(self, value:
ExistingDisk | instance_pb2.ExistingDisk | None):
(source)
¶
Undocumented
@managed_disk.setter
def managed_disk(self, value:
def managed_disk(self, value:
ManagedDisk | instance_pb2.ManagedDisk | None):
(source)
¶
Undocumented
Undocumented
| Value |
|
Undocumented
| Value |
|
Specifies the user-defined identifier, allowing to use '/dev/disk/by-id/virtio-{device_id}' as a device path in mount command.
Attach an existing disk.
Lifecycle:
- The disk is preserved when the instance is deleted (it will be detached).
Switching to a managed disk:
- To delete the disk together with the instance, switch to ManagedDisk in the instance spec.
- For the switch, ManagedDisk.name MUST match the current disk name (see DiskService.Get for the disk referenced by ExistingDisk.id).
- When converting an ExistingDisk to a ManagedDisk, you must provide ManagedDisk.name and ManagedDisk.spec exactly as they are currently defined in the disk resource. Obtain the current values via DiskService.Get and copy them verbatim. If ManagedDisk.spec differs from the current disk spec, the instance update will fail.
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.
@builtins.property
type:
type:
__OneOfClass_type_existing_disk__ | __OneOfClass_type_managed_disk__ | None =
(source)
¶
Undocumented