vmgs: clean up errors and add tracing to vmgstool#2815
Merged
tjones60 merged 7 commits intomicrosoft:mainfrom Feb 24, 2026
Merged
vmgs: clean up errors and add tracing to vmgstool#2815tjones60 merged 7 commits intomicrosoft:mainfrom
tjones60 merged 7 commits intomicrosoft:mainfrom
Conversation
|
This PR modifies files containing For more on why we check whole files, instead of just diffs, check out the Rustonomicon |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves error handling and observability in the VMGS (VM Guest State) implementation by replacing generic anyhow errors with strongly-typed errors and adding comprehensive tracing support to VmgsTool.
Changes:
- Replaces
anyhow::Errorwith specific typed errors in the VMGS library, including new error variants likeNeedsUnlock,DecryptMetadataKey,UnexpectedLength, andInvalidArgument - Adds tracing subscriber to VmgsTool with configurable verbosity levels and converts all
eprintln!calls to appropriate tracing levels (info,warn,error) - Renames methods for clarity:
is_encrypted()→encrypted(),is_encrypted_and_unlocked()→encrypted_and_unlocked() - Updates
FileInfoNotAllocatederror variant to include theFileIdfor better error messages - Adds
Displayimplementation forFileIdto improve log output
Reviewed changes
Copilot reviewed 16 out of 17 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| vm/vmgs/vmgs/src/error.rs | Removes anyhow dependency, adds new typed error variants, updates error messages |
| vm/vmgs/vmgs/src/vmgs_impl.rs | Replaces anyhow! with typed errors, renames encryption check methods, updates error propagation |
| vm/vmgs/vmgs/src/encrypt/win.rs | Replaces anyhow with typed BCrypt error variant |
| vm/vmgs/vmgs/src/encrypt/ossl.rs | Replaces String with &'static str in OpenSSL error messages |
| vm/vmgs/vmgs/Cargo.toml | Removes anyhow dependency, adds windows-result for BCrypt errors |
| vm/vmgs/vmgstool/src/main.rs | Adds tracing initialization, converts error handling to use tracing, improves exit code handling |
| vm/vmgs/vmgstool/src/uefi_nvram.rs | Converts eprintln! to tracing::info!, updates method calls |
| vm/vmgs/vmgstool/src/test.rs | Converts eprintln! to tracing::info! |
| vm/vmgs/vmgstool/src/storage_backend.rs | Updates FileInfoNotAllocated pattern match for new signature |
| vm/vmgs/vmgstool/Cargo.toml | Adds tracing dependencies |
| vm/vmgs/vmgs_format/src/lib.rs | Adds Display implementation for FileId |
| vm/vmgs/vmgs_broker/src/broker.rs | Updates FileInfoNotAllocated pattern match |
| openhcl/underhill_attestation/* | Updates all call sites for renamed methods and error patterns |
| Cargo.toml & Cargo.lock | Adds windows-result workspace dependency |
e489f59 to
c0172f9
Compare
stunes-ms
previously approved these changes
Feb 24, 2026
tjones60
commented
Feb 24, 2026
tjones60
commented
Feb 24, 2026
chris-oo
approved these changes
Feb 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
anyhowerrors in the VMGS implementation and remove any unnecessarily duplicate errors in VmgsTool.