Add --state-dir option to the Python VM launchers

Let each run-*.py launcher take the VM directory (disk, seed ISO, UEFI
variables, PID file, console log) from the command line, taking
precedence over the *_STATE_DIR environment variable. Paths derived
from the state directory are now computed after argument parsing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1dybYsc36kf3gUPB7NuNB
This commit is contained in:
GuofangandClaude Opus 5.5 committed 2026-09-29 13:35:32 +08:00
1 parent a03fb23977
commit 8a7f974c11
5 files changed
+84 -37

No files matched your search

+9
View File
@@ -25,6 +25,15 @@ original qcow2 image as its backing file. The base image therefore stays
unchanged. Resource settings can be overridden with environment variables;
run `./run-debian13.sh --help` for the full list.
The Python launchers (`run-*.py`) accept `--state-dir DIR` to keep
the VM disk, seed ISO, UEFI variables, PID file and console log in `DIR`
instead of the default `.vm/<name>/`. The option takes precedence over the
corresponding `*_STATE_DIR` environment variable:
```bash
./run-debian13.py --state-dir /srv/vms/debian13-test --daemon
```
If `.vm/debian13/seed.iso` is missing, the launcher automatically builds it
from `seediso/debian13/user-data`, `seediso/debian13/meta-data`, and
`seediso/debian13/network-config` before starting the VM.