flowey/resolve_openvmm_deps: unify dep file handling and add petritools erofs#3154
flowey/resolve_openvmm_deps: unify dep file handling and add petritools erofs#3154jstarks wants to merge 1 commit intomicrosoft:mainfrom
Conversation
…ls erofs Replace the per-file request variants (GetLinuxTestKernel, GetLinuxTestInitrd, GetOpenhclCpioDbgrd, GetOpenhclCpioShell, GetOpenhclSysroot) in resolve_openvmm_deps with a single Get(OpenvmmDepFile, arch, var) variant backed by an OpenvmmDepFile enum. This collapses the repetitive per-file matching in both the local-path and download-and-extract code paths into a single loop over the enum. Replace init_openvmm_magicpath_linux_test_kernel (which was specific to the test kernel and initrd) with a generic init_openvmm_magicpath_openvmm_deps module that copies any set of dep files to the magicpath using a declarative table. Adding a new dep file now only requires adding an entry to dep_files(). Use this to wire up the new petritools erofs image: add PETRITOOLS_EROFS_X64 and PETRITOOLS_EROFS_AARCH64 artifact declarations, resolver paths, and the dep file entry. Fix a duplicate-artifact panic in petri_artifacts_core by deduplicating handles during resolution. Bump openvmm-deps to 0.1.0-20260328.1.
There was a problem hiding this comment.
Pull request overview
This PR refactors how openvmm-deps artifacts are requested/resolved in Flowey by unifying per-file request variants into a single Get(OpenvmmDepFile, arch, var) mechanism, adds new Petritools EROFS artifacts (x64/aarch64) to the Petri test artifact system, and updates dependency handling to avoid duplicate-artifact resolution panics.
Changes:
- Replace multiple
resolve_openvmm_depsrequest variants with a singleGetrequest backed by anOpenvmmDepFileenum. - Introduce a generic “copy openvmm-deps files to magicpath” node and wire it into local package restore flows; remove the linux-test-kernel-specific node.
- Add Petritools EROFS artifact declarations + resolver paths, dedupe artifact handles during resolution, and bump
OPENVMM_DEPSversion.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| vmm_tests/petri_artifacts_vmm_test/src/lib.rs | Declares new Petritools EROFS test artifacts (x64/aarch64). |
| vmm_tests/petri_artifact_resolver_openvmm_known_paths/src/lib.rs | Adds known-path + bundle-name resolution for Petritools EROFS images. |
| petri/petri_artifacts_core/src/lib.rs | Deduplicates artifact handles during requirements resolution to prevent duplicate-panics. |
| flowey/flowey_lib_hvlite/src/resolve_openvmm_deps.rs | Unifies dep file resolution via OpenvmmDepFile + single Get request variant; simplifies download/extract logic. |
| flowey/flowey_lib_hvlite/src/lib.rs | Switches exported module from the old linux-test-kernel magicpath node to the new generic openvmm-deps node. |
| flowey/flowey_lib_hvlite/src/init_vmm_tests_env.rs | Updates callers to use Request::Get(OpenvmmDepFile, ...). |
| flowey/flowey_lib_hvlite/src/init_openvmm_magicpath_openvmm_deps.rs | New node that copies a declarative set of openvmm-deps files into the magicpath. |
| flowey/flowey_lib_hvlite/src/init_openvmm_magicpath_openhcl_sysroot.rs | Updates sysroot dep resolution to the new Request::Get API. |
| flowey/flowey_lib_hvlite/src/init_openvmm_magicpath_linux_test_kernel.rs | Removes the old linux-test-kernel/initrd-specific magicpath node. |
| flowey/flowey_lib_hvlite/src/build_openhcl_initrd.rs | Updates OpenHCL cpio dep resolution to the new Request::Get API. |
| flowey/flowey_lib_hvlite/src/build_openhcl_igvm_from_recipe.rs | Updates example kernel/initrd dep resolution to the new Request::Get API. |
| flowey/flowey_lib_hvlite/src/_jobs/local_restore_packages.rs | Wires local restore to run the new openvmm-deps magicpath initializer per-arch. |
| flowey/flowey_lib_hvlite/src/_jobs/cfg_versions.rs | Bumps OPENVMM_DEPS version string to 0.1.0-20260328.1. |
| let mut seen = HashSet::new(); | ||
| let mut resolved = HashMap::new(); | ||
|
|
||
| for &(a, optional) in &self.artifacts { | ||
| // Skip duplicates — the same artifact may be registered by | ||
| // multiple tests. | ||
| if !seen.insert(a) { | ||
| continue; | ||
| } |
There was a problem hiding this comment.
Deduplicating by ErasedArtifactHandle alone can change required/optional semantics: if the same artifact is added both as optional and required, and the optional entry appears first, the required one will be skipped and a missing artifact won’t be reported as an error. Consider merging duplicates by keeping the strictest requirement (treat as required if any registration is required), then resolve each unique artifact once using that merged optional flag.
| let mut seen = HashSet::new(); | |
| let mut resolved = HashMap::new(); | |
| for &(a, optional) in &self.artifacts { | |
| // Skip duplicates — the same artifact may be registered by | |
| // multiple tests. | |
| if !seen.insert(a) { | |
| continue; | |
| } | |
| let mut resolved = HashMap::new(); | |
| // Merge duplicate registrations by handle, keeping the strictest | |
| // requirement (treat as required if any registration is required). | |
| let mut merged: HashMap<ErasedArtifactHandle, bool> = HashMap::new(); | |
| for &(a, optional) in &self.artifacts { | |
| merged | |
| .entry(a) | |
| .and_modify(|existing_optional| { | |
| // `optional == true` means optional; `false` means required. | |
| // We want the strictest semantics: required if any registration is required. | |
| *existing_optional = *existing_optional && optional; | |
| }) | |
| .or_insert(optional); | |
| } | |
| for (a, optional) in merged { |
Replace the per-file request variants (GetLinuxTestKernel, GetLinuxTestInitrd, GetOpenhclCpioDbgrd, GetOpenhclCpioShell, GetOpenhclSysroot) in resolve_openvmm_deps with a single Get(OpenvmmDepFile, arch, var) variant backed by an OpenvmmDepFile enum. This collapses the repetitive per-file matching in both the local-path and download-and-extract code paths into a single loop over the enum.
Replace init_openvmm_magicpath_linux_test_kernel (which was specific to the test kernel and initrd) with a generic init_openvmm_magicpath_openvmm_deps module that copies any set of dep files to the magicpath using a declarative table. Adding a new dep file now only requires adding an entry to dep_files().
Use this to wire up the new petritools erofs image: add PETRITOOLS_EROFS_X64 and PETRITOOLS_EROFS_AARCH64 artifact declarations, resolver paths, and the dep file entry. Fix a duplicate-artifact panic in petri_artifacts_core by deduplicating handles during resolution.
Bump openvmm-deps to 0.1.0-20260328.1.