feat(vmm): improve VMM discovery - XDG_RUNTIME_DIR, cross-user, subcommands#593
Merged
feat(vmm): improve VMM discovery - XDG_RUNTIME_DIR, cross-user, subcommands#593
Conversation
Use $XDG_RUNTIME_DIR/dstack-vmm instead of /run/dstack-vmm so that no root permissions are needed. Falls back to /run/dstack-vmm when XDG_RUNTIME_DIR is not set.
- vmm-cli.py scans /run/user/*/dstack-vmm/ to find instances from all users, not just the current user's XDG_RUNTIME_DIR - Rust side falls back to /run/user/<uid>/dstack-vmm when XDG_RUNTIME_DIR is not set, reading uid from /proc/self/status - Remove /run/dstack-vmm fallback (no longer needed)
Replace /proc/self/status parsing with nix crate's getuid() for cleaner UID detection when XDG_RUNTIME_DIR is not set.
Group VMM instance management commands under a 'vmm' subcommand: vmm-cli.py vmm ls (was: vmm-cli.py ls-vmm) vmm-cli.py vmm switch (was: vmm-cli.py switch-vmm)
Resolve uid from the /run/user/<uid>/dstack-vmm discovery path to a username via pwd.getpwuid() and display it in the USER column.
d4e3e79 to
0919e7a
Compare
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.
Summary
Follow-up to #584. Improvements to the VMM instance discovery mechanism:
$XDG_RUNTIME_DIR/dstack-vmminstead of/run/dstack-vmmso no root permissions are needed; fall back to/run/user/<uid>/dstack-vmmvianix::unistd::getuid()when the env var is unsetvmm-cli.pyscans/run/user/*/dstack-vmm/to discover instances from all users on the host (verified: normal user can discover root's VMM)ls-vmm/switch-vmm→vmm ls/vmm switchsubcommand group--helpoutputTest plan
$XDG_RUNTIME_DIR/dstack-vmm/(tested)/run/user/<uid>/whenXDG_RUNTIME_DIRunset (tested withenv -u)vmm lsandvmm switchwork correctly--helpshows nestedvmm ls/vmm switchcargo fmt,cargo clippyclean