charmcraft: perform LXD checks before use (CRAFT-420)
Metadata
Current evaluation
Merged #474: added ensure_lxd_is_ready() before LXD use, including permission validation and clearer errors. Merge commit: 1dfb54b1.
Resolution: closed resolved
Reason: PR #474 was merged as 1dfb54b1, with implementation commit 4b1f3b0d. It centralized existing LXD readiness checks and added validation for the user's LXD permissions.
Evaluated by: mr-cal-bot
No scores available.
Issue body
Invoke ensure_lxd_is_ready() interface before using LXD
provider. This consolidates a couple of existing checks
done elsewhere as well as a new one for ensuring the user
has the necessary permissions to use LXD.
Minor simplification of imports used in providers module
to improve and update mocks accordingly.
Example error:
```
$ /snap/bin/charmcraft pack
LXD requires additional permissions.
Please ensure that the user is in the 'lxd' group.
(full execution logs in '/home/test1/snap/charmcraft/common/charmcraft-log-0xgcist7')
```
Signed-off-by: Chris Patterson <chris.patterson@canonical.com>
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Merged #474: added ensure_lxd_is_ready() before LXD use, including permission validation and clearer errors. Merge commit: 1dfb54b1. | |
| stealth/space-bunny-alpha | — | closed resolved | Merged PR #474: Charmcraft now calls ensure_lxd_is_ready() before LXD use, consolidating checks and adding permission validation. Merge commit: 1dfb54b1; implementation: 4b1f3b0d. | |
| qwen/qwen3.6-35b-a3b | — | — | Merged to charmcraft, adding pre-use LXD readiness and permission validation to the provider module. Consolidates existing checks, updates mocks, and improves import structure. Approved by two reviewers and passed CI. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged implementation adding pre-use LXD readiness and permission validation to charmcraft. Consolidates existing checks, verifies user group membership, and updates mocks to prevent runtime errors. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #63 lxd: check if LXD is initialized prior to launch (CRAFT-348) | craft-providers | merged | Merged LXD initialization preflight validation for CRAFT-348, adding is_initialized(), launch-time LXDError handling, and unit/integration tests in commit b00bea0. | |
| #69 lxd: ensure user is permitted to use lxd (CRAFT-374) | craft-providers | merged | Merged PR #69 added LXD permission and readiness checks, resolving CRAFT-374 in commit 5478f63. | |
| #71 lxd: account for minimum required version in checks (CRAFT-437) | craft-providers | merged | Merged PR #71 updated LXD readiness checks to enforce the minimum required version and revised ensure_lxd_is_ready() error messages (implementation 9fcd49b). | |
| #590 Improve the LXD init experience | rockcraft | open | Rockcraft should check if LXD is properly installed and configured before pack fails with cryptic messages. Core functionality implemented in craft-providers via is_initialized(). |