feat: add QMP lifecycle control and narrow public API#21
Conversation
- Integrate QMP for graceful VM shutdown and running-state queries. - Make SSH launch timeout configurable and support ephemeral images via auto-cleanup. - Add builder-style chaining for `ImageConfig` and `MachineConfig`. - Tighten the public API surface and align doc comments with rustdoc conventions. Signed-off-by: jl.jiang <jiangjl9807@gmail.com>
There was a problem hiding this comment.
💡 Codex Review
Lines 615 to 616 in 274a42e
When a cached image exists, Image::new returns it immediately and ignores the caller’s ImageConfig.clear request. This breaks the new ephemeral-image contract: users asking for auto-cleanup can get an Image loaded with cached metadata (typically clear = false), so the image file is retained after drop instead of being removed.
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| return Ok(false); | ||
| } | ||
| let socket_path = qmp::qmp_socket_path(&self.id)?; | ||
| Ok(qmp::query_running(&socket_path).await.unwrap_or(false)) |
There was a problem hiding this comment.
Propagate QMP errors from running-state checks
Machine::is_running currently maps any QMP failure to false with unwrap_or(false), which makes callers treat communication failures as “VM not running.” In MachinePool::shutdown_all, that means a live VM can be skipped entirely if QMP is temporarily unreachable, leaving the QEMU process orphaned instead of surfacing an error and attempting teardown.
Useful? React with 👍 / 👎.
ImageConfigandMachineConfig.