Conversation
Add boot-time block device mapping (BDM) to the Server resource, enabling boot-from-volume and custom disk configurations at server creation time. This complements the existing post-creation volume attachment via the volumes field. Changes: - Add ServerBlockDeviceSpec type with sourceType (volume/image/blank), volumeRef, imageRef, bootIndex, volumeSizeGiB, destinationType, deleteOnTermination, diskBus, deviceType, volumeType, and tag fields - Add blockDevices field to ServerResourceSpec (immutable after creation) - Make imageRef optional (pointer) to support boot-from-volume without a top-level image reference - Add CEL validations: require either imageRef or a blockDevice with bootIndex 0; enforce sourceType/ref consistency - Add bdmVolumeDependency and bdmImageDependency with deletion guards - Wire BDM dependencies into SetupWithManager watches - Resolve BDM dependencies and build BlockDevice slice in CreateResource - Regenerate deepcopy, apply configurations, CRDs, and docs
Add three test suites covering block device mapping functionality: - server-create-bdm: Boot from volume using image source with no top-level imageRef. Verifies server reaches ACTIVE with volume attached and correct network configuration. - server-create-bdm-volume: Boot from an existing ORC Volume. Creates a bootable volume from image, then references it in BDM with sourceType: volume. - server-bdm-dependency: Tests BDM dependency ordering and deletion guards. Verifies server waits for missing BDM image dependency, becomes available once created, and that the image has a deletion guard finalizer preventing premature deletion.
|
Fixes issue #365 |
|
Hey @dalehenries! Thanks for working on this. I wanted to make sure you notice that we already have PR #634 addressing boot-from-volume. #634 should cover BFV but if you notice a feature missing in it feel free to propose a patch that overlays on it :) While going through your implementation, I noticed some violations of ORC's core principles. I'd recommend checking the development docs to understand the project philosophy better. For example, the implementation creates OpenStack resources inline rather than referencing ORC objects. This creates a Cinder volume directly in OpenStack instead of referencing an ORC Volume CR. This violates the core principle from our docs:
In ORC, volumes should be created as Volume CRs and then referenced, not created inline during Server creation. Another example is exposing Would be very glad to see more contributions to the project in the future! Let me know if you have questions/I can help in any way. |
Summary
boot-from-volume and custom disk configurations at server creation time
ServerBlockDeviceSpectype supportingsourceType(volume/image/blank),with references to ORC Volume and Image objects
imageRefoptional onServerResourceSpecto support boot-from-volumewithout a top-level image reference
imageRefor a bootable block devicebdmVolumeDependencyandbdmImageDependencywith deletion guardsBDM, and BDM dependency ordering/deletion guards
Details
Block device mapping is immutable after creation and complements the existing
mutable
volumesfield (post-creation hot-attach). TheblockDevicesfield mapsdirectly to Nova's
block_device_mapping_v2via gophercloud'sservers.BlockDevice.API changes
ServerResourceSpec.ImageRefchanged fromKubernetesNameRefto*KubernetesNameRef(now optional)ServerResourceSpec.BlockDevices []ServerBlockDeviceSpecfield (immutable)ServerBlockDeviceSpecstruct with fields:sourceType,volumeRef,imageRef,bootIndex,volumeSizeGiB,destinationType,deleteOnTermination,diskBus,deviceType,volumeType,tagServerResourceSpec: requires eitherimageRefor a blockdevice with
bootIndex == 0Test plan
server-create-bdm: Boot from volume using image source (no top-levelimageRef), verify ACTIVE with volume attached
server-create-bdm-volume: Boot from existing ORC Volume, verify ACTIVEwith volume attached
server-bdm-dependency: Verify server waits for missing BDM image, becomesavailable when created, image has deletion guard finalizer
server-create-minimalandserver-create-fulltests continueto pass (imageRef still works)