-
Notifications
You must be signed in to change notification settings - Fork 15
engineering: Derive Host Config from COSI v1.2 #479
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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-imagecommand from feature-gated to hidden, routing through newTrident::stream_imagemethod
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 |
There was a problem hiding this 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.
There was a problem hiding this 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.
| strategy: DiskSelectionStrategy, | ||
| candidates: Vec<BlockDevice>, | ||
| ) -> Result<(), Error> { | ||
| let Some(disk) = host_config.storage.disks.get_mut(0) else { |
There was a problem hiding this comment.
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?
🔍 Description
stream-imagecommand now hidden instead of feature-gated.osutils::lsblk::BlockDevice::device_path().InternalParams::set_flagto accept Into, and minor test/data cleanups.