Skip to content

refactor(vmm): separate qemu launch concerns#787

Merged
kvinwang merged 1 commit into
masterfrom
refactor/vmm-split-qemu-module
Jul 16, 2026
Merged

refactor(vmm): separate qemu launch concerns#787
kvinwang merged 1 commit into
masterfrom
refactor/vmm-split-qemu-module

Conversation

@kvinwang

Copy link
Copy Markdown
Collaborator

Problem

vmm/src/app/qemu.rs mixed QEMU launch mechanics with unrelated responsibilities: VM workdir persistence, RPC presentation, application identity/measurement derivation, and host-share disk creation. VmConfig::config_qemu also interleaved host filesystem/probing side effects with a large block of command-line construction, which made the launch arguments difficult to test without a prepared host environment.

Fix

  • move VM workdir layout and persisted state into workdir.rs
  • move runtime-state aggregation and protobuf presentation into vm_info.rs
  • move MAC/application identity and TDX/SNP measurement derivation into mr_config.rs
  • move FAT32 host-share image creation into host_share.rs
  • preserve the existing VmConfig and VmWorkDir re-exports for callers
  • add PreparedQemuLaunch for disk creation, config reads, NUMA/TPM probing, and SNP capability detection
  • add a decomposed QemuCommandBuilder for host-I/O-free QEMU argument construction
  • add a unit test proving command construction works with nonexistent prepared paths

Verification

  • cargo test -p dstack-vmm
  • cargo clippy -p dstack-vmm --all-targets --all-features -- -D warnings
  • ./run-tests.sh

Copilot AI review requested due to automatic review settings July 16, 2026 07:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors dstack-vmm’s QEMU integration by separating VM workdir/state persistence, runtime info/protobuf presentation, measurement/app-identity derivation, and host-share image creation from QEMU launch preparation and command-line construction. This aims to make QEMU argument construction more testable and reduce host-side side effects in the command-building path.

Changes:

  • Introduced workdir.rs for VM workdir layout + persisted state (manifest/state/paths, instance info, sys/app config accessors).
  • Introduced vm_info.rs for aggregating runtime state into VmInfo and converting to protobuf for RPC.
  • Split out measurement/app identity logic into mr_config.rs and host-share FAT disk creation into host_share.rs, while restructuring QEMU launch into PreparedQemuLaunch + QemuCommandBuilder (and adding a unit test for command construction with nonexistent paths).

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
dstack/vmm/src/app/workdir.rs New module encapsulating VM workdir paths and persisted state access.
dstack/vmm/src/app/vm_info.rs New module for VM runtime info merging and RPC/protobuf presentation.
dstack/vmm/src/app/qemu.rs Refactors QEMU launch into preparation vs command building; adds builder-focused unit test.
dstack/vmm/src/app/mr_config.rs New module for MAC + TDX/SNP measurement/app identity derivation and persisted instance info updates.
dstack/vmm/src/app/host_share.rs New module extracting FAT32 host-share disk image creation.
dstack/vmm/src/app.rs Wires in new modules and updates re-exports/imports accordingly.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread dstack/vmm/src/app/qemu.rs
@kvinwang
kvinwang merged commit 7b1b493 into master Jul 16, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants