Skip to content

Conversation

@smalis-msft
Copy link
Contributor

Create a dynamic VHDX when using Hyper-V, configure Windows (IMC/prep steps) and Linux (cloud-init) to mount it, configure Windows to put kernel dumps on it, and add a post test hook to artifact all files that end up on it. Wiring up Linux crashes, Windows user mode crashes, and the OpenVMM backend are left as future work.

@smalis-msft smalis-msft requested a review from a team as a code owner November 11, 2025 22:40
Copilot AI review requested due to automatic review settings November 11, 2025 22:40
@smalis-msft smalis-msft requested a review from a team as a code owner November 11, 2025 22:40
@github-actions github-actions bot added the unsafe Related to unsafe code label Nov 11, 2025
@github-actions
Copy link

⚠️ Unsafe Code Detected

This PR modifies files containing unsafe Rust code. Extra scrutiny is required during review.

For more on why we check whole files, instead of just diffs, check out the Rustonomicon

Copy link
Contributor

Copilot AI left a 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 adds support for collecting crash dumps from guest VMs in the petri testing framework. It creates a dedicated crash dump disk for Windows and Linux guests, configures the guests to use it for kernel dumps, and extracts the dump files as test artifacts after each test.

Key changes:

  • Creates a 4 GiB dynamic VHDX for Hyper-V guests to store crash dumps
  • Configures Windows via IMC to write kernel memory dumps to the crash disk
  • Configures Linux via cloud-init to mount the crash dump disk
  • Adds post-test hooks to extract crash dump files from the disk as test artifacts

Reviewed Changes

Copilot reviewed 11 out of 13 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
vmm_tests/vmm_tests/tests/tests/multiarch.rs Adds kernel crash test that writes a test file and triggers a kernel crash
petri/src/vm/openvmm/mod.rs Adds stub implementation of create_guest_dump_disk for OpenVMM (returns None)
petri/src/vm/openvmm/construct.rs Attaches crash dump disk as read-only SCSI device to OpenVMM VMs
petri/src/vm/mod.rs Core logic for creating crash disk and post-test extraction hook
petri/src/vm/hyperv/mod.rs Creates and formats dynamic VHDX for crash dumps on Hyper-V
petri/src/test.rs Removes Send requirement from PetriPostTestHook
petri/src/disk_image.rs Makes FAT32 disk building utilities public for reuse
petri/make_imc_hive/src/windows/offreg.rs Adds set_expand_sz method for registry editing
petri/make_imc_hive/src/windows/mod.rs Configures Windows kernel crash dump settings via IMC
petri/guest-bootstrap/user-data Adds cloud-init commands to mount crash dump disk on Linux
petri/guest-bootstrap/imc.hiv Binary registry hive file update
petri/Cargo.toml Adds disk_backend dependency
Cargo.lock Updates dependency lock file

@github-actions

This comment was marked as outdated.

@github-actions

This comment was marked as outdated.

@github-actions
Copy link

@smalis-msft smalis-msft changed the title WIP: petri: Add the ability to collect crash dumps from guests petri: Add the ability to collect crash dumps from guests Nov 12, 2025
@smalis-msft
Copy link
Contributor Author

This is now reviewable. Assuming this latest run works I'll delete the test and then merge. There's no good way to have a fully automated test for this unfortunately, since the dump collection infra has to live outside the actual test in order to catch test failures.

@smalis-msft
Copy link
Contributor Author

Filed #2403 to track remaining pieces

@github-actions

This comment was marked as outdated.

@smalis-msft smalis-msft requested a review from a team as a code owner November 13, 2025 16:41
@smalis-msft
Copy link
Contributor Author

Ok, with the last hyper-v annoyance worked around this is now ready to go.

@smalis-msft smalis-msft enabled auto-merge (squash) November 13, 2025 23:03
@smalis-msft smalis-msft merged commit d189f4b into microsoft:main Nov 13, 2025
56 checks passed
@smalis-msft smalis-msft deleted the vmm-test-dumps-2 branch November 13, 2025 23:21
@smalis-msft
Copy link
Contributor Author

Now we wait...

smalis-msft added a commit that referenced this pull request Nov 14, 2025
In #2394 I added this new
action to our log upload script, as if there are many crash dumps
present during a test run the uploader can run out of disk space.
However since this script only runs out of main I couldn't test the
changes. Turns out the cleaner removes azure cli, which we kinda need.
Fix that.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

unsafe Related to unsafe code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants