Skip to content

feat(vmm): added one-shot#288

Merged
Leechael merged 9 commits into
masterfrom
imp-vmm-oneshot
Aug 23, 2025
Merged

feat(vmm): added one-shot#288
Leechael merged 9 commits into
masterfrom
imp-vmm-oneshot

Conversation

@Leechael

@Leechael Leechael commented Aug 12, 2025

Copy link
Copy Markdown
Collaborator

This PR proposes adding a flag dstack-vmm --one-shot <path_to_vm_configuration.json> that allows starting a CVM without launching the supervisor daemon and dstack-vmm daemon, which can be useful for QEMU debugging or benchmarking.

Example output:

$ ~/meta-dstack/dstack/target/release/dstack-vmm -c ~/meta-dstack/build/dev-0.5.1/vmm.toml --one-shot vm_config.json
# Allocated CID: 1000 (found 27 existing QEMU VMs with CIDs: [80001, 1009, 1011, 1007, 1008, 22016, 1001, 1003, 80003, 1002, 1004, 1005, 1006, 22001, 22002, 22003, 22004, 22005, 22006, 22007, 22009, 22011, 22012, 22013, 22014, 80006, 80007])
# One-shot VM execution mode
# Configuration: vm_config.json
# Working directory: /home/leechael/test-app/dstack-oneshot-test-dumps-1754984378
# Compose hash: 7f1b6e01c2af9a98e82b9625d3d16a17c08d907a90c9884a6ad0ce36fea849d7
# App ID: 095ec7fe60d7b7832d1aefd5830627d275cf756b
# VM ID: 84f2fec2-8e4c-4faf-b601-0794aaa63e4b
#
# QEMU Command:
/usr/bin/qemu-system-x86_64 -accel kvm -cpu host -nographic -nodefaults -chardev pty,id=com0,path=/home/leechael/test-app/dstack-oneshot-test-dumps-1754984378/serial.pty,logfile=/home/leechael/test-app/dstack-oneshot-test-dumps-1754984378/serial.log -serial chardev:com0 -bios /home/leechael/meta-dstack/build/dev-0.5.1/images/dstack-dev-0.5.3/ovmf.fd -kernel /home/leechael/meta-dstack/build/dev-0.5.1/images/dstack-dev-0.5.3/bzImage -initrd /home/leechael/meta-dstack/build/dev-0.5.1/images/dstack-dev-0.5.3/initramfs.cpio.gz -drive file=/home/leechael/meta-dstack/build/dev-0.5.1/images/dstack-dev-0.5.3/rootfs.img.verity,if=none,id=hd0,format=raw,readonly=on -device virtio-blk-pci,drive=hd0 -drive file=/home/leechael/test-app/dstack-oneshot-test-dumps-1754984378/hda.img,if=none,id=hd1 -device virtio-blk-pci,drive=hd1 -netdev user,id=net0,net=10.0.2.0/24,dhcpstart=10.0.2.10,restrict=no -device virtio-net-pci,netdev=net0 -machine q35,kernel-irqchip=split,confidential-guest-support=tdx,hpet=off -object tdx-guest,id=tdx,mrconfigid=AX8bbgHCr5qY6CuWJdPRahfAjZB6kMmISmrQzjb+qEnXAAAAAAAAAAAAAAAAAAAA -device vhost-vsock-pci,guest-cid=1000 -virtfs local,path=/home/leechael/test-app/dstack-oneshot-test-dumps-1754984378/shared,mount_tag=host-shared,readonly=on,security_model=mapped,id=virtfs0 -smp 1 -m 2048M -append console=ttyS0 init=/init panic=1 systemd.unified_cgroup_hierarchy=0 net.ifnames=0 biosdevname=0 mce=off oops=panic pci=noearly pci=nommconf random.trust_cpu=y random.trust_bootloader=n tsc=reliable no-kvmclock dstack.rootfs_hash=f2f8c1df568aff0caf1fa6531b3904895b908d38f1c0f9ab91849c7b45515a6d dstack.rootfs_size=150847488
# Executing QEMU...

@Leechael
Leechael force-pushed the imp-vmm-oneshot branch 3 times, most recently from 38427bb to 3879d26 Compare August 12, 2025 11:22
@Leechael
Leechael marked this pull request as ready for review August 12, 2025 11:23
@Leechael
Leechael requested a review from kvinwang August 12, 2025 11:23

@kvinwang kvinwang left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

My concern to this PR.

  • If there is already a dstack-vmm running, why not just use vmm-cli.py to create a initial stopped VM. maybe an additional RPC for the qemu args is OK?
  • Part of one_shot.rs and validation.rs feels hard to maintain.

Comment thread vmm/src/app/qemu.rs Outdated
Comment thread vmm/src/main.rs Outdated
Comment thread vmm/src/one_shot.rs Outdated
Comment thread vmm/src/app/qemu.rs Outdated
Comment thread vmm/src/main.rs Outdated

@kvinwang kvinwang left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@Leechael
Leechael merged commit 2188086 into master Aug 23, 2025
10 checks passed
@Leechael
Leechael deleted the imp-vmm-oneshot branch August 23, 2025 04:09
kvinwang pushed a commit that referenced this pull request Jan 19, 2026
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