-
Notifications
You must be signed in to change notification settings - Fork 162
petri: backend agnostic vtl2 settings configuration #2550
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
petri: backend agnostic vtl2 settings configuration #2550
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 refactors VTL2 (Virtual Trust Level 2) settings configuration to be backend-agnostic, allowing both OpenVMM and Hyper-V backends to configure VTL2 settings using the same unified API. This improves consistency and maintainability across the petri test framework.
Key changes:
- Simplified
Vtl2StorageControllerBuilderAPI by replacingscsi()andwith_protocol()with a singlenew(protocol)constructor - Moved VTL2 settings from backend-specific resources to a shared
PetriVmRuntimeConfigstructure - Unified VTL2 settings modification through
vm.modify_vtl2_settings()instead of backend-specific methods
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| petri/src/vm/vtl2_settings.rs | Simplified Vtl2StorageControllerBuilder API with unified constructor |
| petri/src/vm/mod.rs | Added PetriVmRuntimeConfig, unified VTL2 settings configuration, and runtime modification methods |
| petri/src/vm/openvmm/mod.rs | Moved VTL2 settings from resources to config, implemented default_vtl2_settings() trait method |
| petri/src/vm/openvmm/start.rs | Updated to return PetriVmRuntimeConfig and apply VTL2 settings consistently |
| petri/src/vm/openvmm/runtime.rs | Changed VTL2 settings modification from stateful to stateless set_vtl2_settings() |
| petri/src/vm/openvmm/modify.rs | Updated to use unified VTL2 settings location |
| petri/src/vm/openvmm/construct.rs | Updated VTL2 storage controller builder usage |
| petri/src/vm/hyperv/mod.rs | Removed backend-specific VTL2 config methods, implemented unified trait methods |
| vmm_tests/vmm_tests/tests/tests/x86_64/storage.rs | Updated tests to use new unified VTL2 settings API |
| vmm_tests/vmm_tests/tests/tests/x86_64/openhcl_linux_direct.rs | Updated to use new Vtl2StorageControllerBuilder::new() API |
| vmm_tests/vmm_tests/tests/tests/multiarch/openhcl_servicing.rs | Updated to use new Vtl2StorageControllerBuilder::new() API |
| pub tpm: Option<TpmConfig>, | ||
| } | ||
|
|
||
| /// VM configuration that can be changed after the VM is created |
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.
So I understand the intent ... will this eventually include things like disks? (a disk can be added/removed at runtime, but not a controller)
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.
Yes exactly. In my storage PR #2551 I added the storage controllers here. Also, I do eventually want to separate the creation from the start, so I think it is fine to include things here that can only change when the VM is off, and the PetriVm struct will enforce what is allowed when the VM is running vs stopped (this struct won't be directly exposed to the test).
Move some stuff around so configuring VTL2 settings is done the same way across both backends.