OCI Block Volumes
cloudspells.providers.oci.volume
Volume specification dataclass for CloudSpells compute block volumes.
Provides VolumeSpec, a typed descriptor for a single OCI block volume to be
created and attached to a ComputeInstance. Pass a list of specs to
ComputeInstance(volumes=[...]) to attach multiple volumes at creation time.
Exports
VolumeSpec: Block-volume descriptor dataclass.
VolumeSpec
dataclass
Descriptor for a single OCI block volume attached to a compute instance.
Each VolumeSpec produces one oci.core.Volume and one
oci.core.VolumeAttachment. Pass a list to
ComputeInstance(volumes=[...]); the block iterates over the list and
creates resources for every entry.
Performance is expressed via vpus_per_gb using the four OCI tiers
exposed as class-level constants.
Attributes:
| Name | Type | Description |
|---|---|---|
size_in_gbs |
int
|
Volume size in GiB. Minimum 50. |
label |
str
|
Short slug used to derive the Pulumi resource name suffix
(e.g. |
vpus_per_gb |
int
|
OCI volume performance-unit tier. Use the class
constants |
is_read_only |
bool
|
Attach the volume read-only. Defaults to |
device |
str | None
|
Device path override for the paravirtualized attachment
(e.g. |
defined_tags |
dict[str, Any] | None
|
OCI defined tags applied to the block volume resource,
in |
Class Attributes
PERF_LOW: Low-cost tier — 0 VPUs/GB. PERF_BALANCED: Default balanced tier — 10 VPUs/GB. PERF_HIGH: High-performance tier — 20 VPUs/GB. PERF_ULTRA: Ultra-high-performance tier — 120 VPUs/GB.
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Example
from cloudspells.providers.oci.volume import VolumeSpec
# Default balanced 100 GiB data volume (simplest usage)
vol = VolumeSpec(size_in_gbs=100)
# High-performance 500 GiB database volume with explicit device path
db_vol = VolumeSpec(
size_in_gbs=500,
label="db",
vpus_per_gb=VolumeSpec.PERF_HIGH,
device="/dev/oracleoci/oraclevdb",
)
# Read-only 50 GiB reference volume
ref_vol = VolumeSpec(size_in_gbs=50, label="ref", is_read_only=True)
Source code in packages/cloudspells-oci/src/cloudspells/providers/oci/volume.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | |
__post_init__() -> None
Validate field values on construction.
Raises:
| Type | Description |
|---|---|
ValueError
|
If any field violates its constraint. |
Source code in packages/cloudspells-oci/src/cloudspells/providers/oci/volume.py
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | |