BaseChipsetBuilder should accept VmChipsetResult directly instead of piecemeal fields
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 1.9k
- Forks
- 238
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 100
Description
Summary
VmManifestBuilder::build() returns a VmChipsetResult containing chipset (the manifest), chipset_devices, pci_chipset_devices, and capabilities. At every call site, that struct is immediately destructured and its fields are passed individually into BaseChipsetBuilder via separate builder calls:
// underhill_core/src/worker.rs (and openvmm_core/src/worker/dispatch.rs)
let VmChipsetResult {
chipset,
mut chipset_devices,
pci_chipset_devices,
capabilities,
} = chipset.build()?;
// ... later ...
BaseChipsetBuilder::new(foundation, devices)
.with_expected_manifest(chipset)
.with_device_handles(chipset_devices)
.with_pci_device_handles(pci_chipset_devices)
// ...
.build(...)
.await?;
This pattern appears in at least two places:
openhcl/underhill_core/src/worker.rsopenvmm/openvmm_core/src/worker/dispatch.rs
Proposed Change
1. BaseChipsetBuilder: accept VmChipsetResult directly
Add a with_vm_chipset_result(result: VmChipsetResult) method (or integrate it into BaseChipsetBuilder::new) so callers can pass the whole VmChipsetResult directly, eliminating the repetitive destructuring at each call site.
2. VmConfig in openvmm_core: consolidate chipset fields
VmConfig currently stores the VmChipsetResult fields split across separate fields:
chipset: BaseChipsetManifestchipset_devices: Vec<ChipsetDeviceHandle>pci_chipset_devices: Vec<LegacyPciChipsetDeviceHandle>chipset_capabilities: VmChipsetCapabilities
These are effectively the same as VmChipsetResult. Replacing them with a single VmChipsetResult field would keep the two types in sync and reduce divergence risk.
Motivation
VmChipsetResult's fields were designed together and are produced together — splitting them apart at every consumer is accidental complexity.- If
VmChipsetResultgains or loses fields in the future, each call site must be updated manually; a singlewith_vm_chipset_resultcall handles this automatically. - Reduces boilerplate at call sites.
Affected Files
vmm_core/vmotherboard/src/base_chipset.rs— add the new methodopenhcl/underhill_core/src/worker.rs— update call siteopenvmm/openvmm_core/src/worker/dispatch.rs— update call site andVmConfigopenvmm/openvmm_entry/src/lib.rs— update call sitepetri/src/vm/openvmm/construct.rs— may need updating depending on howVmChipsetResultflows through
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with vmm_core/vmotherboard/src/base_chipset.rs and trace VmChipsetResult through the worker and dispatch call sites listed in the issue. Check the affected Rust crates, then update each consumer so the complete result is passed together and verify that openvmm_core::VmConfig no longer splits those fields.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- operating-systems
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 50/100