Skip to content

Server block device mapping#710

Open
dalehenries wants to merge 2 commits intok-orc:mainfrom
dalehenries:server-block-device-mapping
Open

Server block device mapping#710
dalehenries wants to merge 2 commits intok-orc:mainfrom
dalehenries:server-block-device-mapping

Conversation

@dalehenries
Copy link

Summary

  • Add boot-time block device mapping (BDM) to the Server resource, enabling
    boot-from-volume and custom disk configurations at server creation time
  • Add ServerBlockDeviceSpec type supporting sourceType (volume/image/blank),
    with references to ORC Volume and Image objects
  • Make imageRef optional on ServerResourceSpec to support boot-from-volume
    without a top-level image reference
  • Add CEL validations enforcing sourceType/ref consistency and requiring either
    imageRef or a bootable block device
  • Add bdmVolumeDependency and bdmImageDependency with deletion guards
  • Add three KUTTL E2E test suites: boot-from-image BDM, boot-from-existing-volume
    BDM, and BDM dependency ordering/deletion guards

Details

Block device mapping is immutable after creation and complements the existing
mutable volumes field (post-creation hot-attach). The blockDevices field maps
directly to Nova's block_device_mapping_v2 via gophercloud's servers.BlockDevice.

API changes

  • ServerResourceSpec.ImageRef changed from KubernetesNameRef to
    *KubernetesNameRef (now optional)
  • New ServerResourceSpec.BlockDevices []ServerBlockDeviceSpec field (immutable)
  • New ServerBlockDeviceSpec struct with fields: sourceType, volumeRef,
    imageRef, bootIndex, volumeSizeGiB, destinationType,
    deleteOnTermination, diskBus, deviceType, volumeType, tag
  • CEL validation on ServerResourceSpec: requires either imageRef or a block
    device with bootIndex == 0

Test plan

  • server-create-bdm: Boot from volume using image source (no top-level
    imageRef), verify ACTIVE with volume attached
  • server-create-bdm-volume: Boot from existing ORC Volume, verify ACTIVE
    with volume attached
  • server-bdm-dependency: Verify server waits for missing BDM image, becomes
    available when created, image has deletion guard finalizer
  • Existing server-create-minimal and server-create-full tests continue
    to pass (imageRef still works)

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.
@dalehenries
Copy link
Author

Fixes issue #365

@eshulman2
Copy link
Contributor

eshulman2 commented Mar 16, 2026

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:

ORC dependencies can only be expressed between ORC objects. Therefore if one OpenStack resource depends on another, that relationship can only be expressed in ORC if both resources have corresponding ORC objects.

In ORC, volumes should be created as Volume CRs and then referenced, not created inline during Server creation.

Another example is exposing deleteOnTermination which can create orphaned resources - if set to false, Nova doesn't deletes the OpenStack volume and ORC leaves an orphaned volume on the openstack cluster which the user can't see from the ORC scope.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

semver:major Breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants