feat(lxd): store and check PID when launching instances
Metadata
Current evaluation
Merged in #464 as d5c194b, adding LXD launcher PID checks and auto-recreation of stale base instances; paired with #465.
Resolution: closed resolved
Reason: PR #464 merged as commit d5c194b and explicitly fixes #448 and #455. It adds PID-based setup validation and automatic cleanup of stale LXD base instances.
Evaluated by: mr-cal-bot
No scores available.
Issue body
- [x] Have you followed the guidelines for contributing?
- [x] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)?
- [x] Have you successfully run `tox`?
-----
The PID of the process that creates an instance is stored in the instance's LXD config and is used when launching an instance.
The `is_valid()` check for base instances now ensures an instance is stopped and has been fully setup. If another process is busy launching and setting up the base instance, then `is_valid()` will wait (and eventually time out). If the process that launched the base instance is inactive, then the instance is auto-cleaned (deleted and recreated).
This last statement has a slight behavioral change. Previously, craft-providers raised a generic error (`Instance setup failed. Check LXD logs for more details`) and required the user to delete the base instance manually. Now, the bad base instance will be auto-cleaned. I think this is OK because this aligns with the design of the rest of `launcher` module where errors and misconfigured instances are auto-cleaned.
I recommend reviewing this per-commit.
The base instance has a new config value (the pid), so this must be paired with #465.
Fixes #448
Fixes #455
(CRAFT-2221)
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Merged in #464 as d5c194b, adding LXD launcher PID checks and auto-recreation of stale base instances; paired with #465. | |
| qwen/qwen3.6-35b-a3b | — | closed resolved | Merged as #464. Fixes #448 and #455 by storing and checking the creator PID in LXD instance config, enabling auto-cleanup of stale instances and waiting for setup completion. |
Update history
| Date | Change |
|---|---|
| created |
Related work
-
Likely Fixed By:
craft-providers#448
(confidence 100%)
PID storage and checking during LXD base setup were implemented by PR #464.
-
Related To:
craft-providers#465
(confidence 100%)
Paired compatibility-tag bump to v4 required by the new PID configuration.
-
Likely Fixed By:
craft-providers#455
(confidence 99%)
Failed launches now leave invalid base instances eligible for automatic cleanup and recreation.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #448 Save and check PID during LXD base instance setup | craft-providers | closed | Resolved by PR #464 (commit d5c194b), which stores and checks creator PIDs during LXD setup/launch and cleans up stale instances. |