Skip to content

Conversation

@frhuelsz
Copy link
Contributor

🔍 Description

  • Replace COSI host configuration templates with derived Host Configuration from COSI metadata (v1.2+), plus disk selection logic (smallest fit, GPT overhead, 4 KiB padding) and new tests around sizing/selection.
  • Add Trident::stream_image and route stream-image flow through it in CLI/daemon/harpoon, with stream-image command now hidden instead of feature-gated.
  • Extend API storage modeling: Partition::new, mapping from discoverable partition types.
  • New errors for derived Host Configuration and no suitable disk found.
  • Add osutils::lsblk::BlockDevice::device_path().
  • Loosen InternalParams::set_flag to accept Into, and minor test/data cleanups.

@frhuelsz frhuelsz requested a review from a team as a code owner January 27, 2026 23:06
Copilot AI review requested due to automatic review settings January 27, 2026 23:06
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR replaces the COSI host configuration template-based approach with automatic derivation from COSI v1.2 metadata. The changes eliminate the Tera templating engine in favor of direct metadata-to-configuration translation, and introduce disk selection logic with size calculation including GPT overhead.

Changes:

  • Adds derived Host Configuration generation from COSI v1.2+ metadata with partition and filesystem mapping
  • Implements disk selection logic with smallest-fit strategy, GPT overhead calculation, and 4KiB padding
  • Removes template-based configuration expansion in favor of direct derivation
  • Adds new API methods and error types for derived configuration and disk selection
  • Changes stream-image command from feature-gated to hidden, routing through new Trident::stream_image method

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
crates/trident_api/src/error.rs Adds error variants for derived host configuration validation and no suitable disk found
crates/trident_api/src/config/host/storage/partitions.rs Adds Partition::new constructor and From<DiscoverablePartitionType> implementation
crates/trident_api/src/config/host/internal_params.rs Loosens set_flag to accept Into<String> for ergonomics
crates/trident_api/src/config/host/mod.rs Test cleanup using simplified set_flag call
crates/trident/src/stream.rs Complete refactor from template expansion to disk selection with size calculations
crates/trident/src/server/tridentserver/harpoon_impl.rs Routes stream-image through new Trident::stream_image method
crates/trident/src/osimage/mod.rs Changes API from host_configuration_template to derived_host_configuration
crates/trident/src/osimage/cosi/validation.rs Simplifies version comparisons using new PartialOrd implementations
crates/trident/src/osimage/cosi/mod.rs Removes host_configuration_template field, adds derived_hc module
crates/trident/src/osimage/cosi/metadata.rs Adds comparison operators between KnownMetadataVersion and MetadataVersion
crates/trident/src/osimage/cosi/derived_hc.rs New module implementing Host Configuration derivation from COSI metadata
crates/trident/src/offline_init/mod.rs Test cleanup using simplified set_flag call
crates/trident/src/main.rs Implements stream-image command routing through Trident::stream_image
crates/trident/src/lib.rs Adds stream_image public method with image loading and config derivation
crates/trident/src/cli.rs Changes stream-image from feature-gated to hidden command
crates/osutils/src/lsblk.rs Adds device_path() helper method and test

fintelia
fintelia previously approved these changes Jan 27, 2026
Copilot AI review requested due to automatic review settings January 28, 2026 00:45
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 17 out of 18 changed files in this pull request and generated 1 comment.

Copilot AI review requested due to automatic review settings January 28, 2026 01:02
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 17 out of 18 changed files in this pull request and generated 2 comments.

fintelia
fintelia previously approved these changes Jan 28, 2026
strategy: DiskSelectionStrategy,
candidates: Vec<BlockDevice>,
) -> Result<(), Error> {
let Some(disk) = host_config.storage.disks.get_mut(0) else {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is hard-coding the first disk potentially problematic? or are we going to doc that this is just how we choose partitions?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants