Skip to content

feat(vmm): local VMM instance discovery#584

Merged
kvinwang merged 1 commit intomasterfrom
worktree-vmm-discovery
Mar 20, 2026
Merged

feat(vmm): local VMM instance discovery#584
kvinwang merged 1 commit intomasterfrom
worktree-vmm-discovery

Conversation

@kvinwang
Copy link
Copy Markdown
Collaborator

Summary

  • Each dstack-vmm process registers itself in /run/dstack-vmm/<uuid>.json on startup with instance metadata (listen address, pid, working dir, config path, image/run paths, node name, version)
  • Registration file is automatically cleaned up on normal shutdown via Drop; stale files from crashed processes are detected by checking /proc/<pid> and cleaned on next VMM startup
  • vmm-cli.py gains ls-vmm and switch-vmm <id> commands for multi-instance management
  • Auto-discovery: when no explicit --url is given, CLI auto-connects to the active or sole running VMM instance

Test plan

  • Two TCP VMM instances: ls-vmm shows both with correct ports
  • switch-vmm with prefix match, * marker, and lsvm auto-connects to selected instance
  • UDS listener (unix:./vmm.sock): discovery file, path resolution, auto-connect all work
  • Normal exit (SIGTERM): Drop removes registration file
  • Abnormal exit (SIGKILL): stale file remains but ls-vmm filters by /proc/<pid> check
  • cargo fmt, cargo clippy clean

@kvinwang kvinwang force-pushed the worktree-vmm-discovery branch from 46a1adc to 82f9424 Compare March 20, 2026 02:28
Each dstack-vmm process now registers itself in /run/dstack-vmm/<uuid>.json
on startup with instance metadata (address, pid, working dir, config, etc.)
and cleans up on shutdown via Drop. Stale files from crashed processes are
detected by checking /proc/<pid> and cleaned on next startup.

vmm-cli.py gains two new commands:
- ls-vmm: list all running VMM instances on the host
- switch-vmm: select the active instance (prefix match on UUID)

Auto-discovery resolves the VMM URL when no explicit --url is given:
if an active instance is set it connects there; if exactly one instance
is running it connects automatically.
@kvinwang kvinwang force-pushed the worktree-vmm-discovery branch from 82f9424 to 428738f Compare March 20, 2026 02:32
@kvinwang kvinwang enabled auto-merge March 20, 2026 02:35
@kvinwang kvinwang merged commit e4c0ed2 into master Mar 20, 2026
14 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.

1 participant