Skip to content

Fix a few issues in LXD backend#492

Merged
dmitry-lyfar merged 3 commits into
mainfrom
fix/lxd-backend
Sep 22, 2025
Merged

Fix a few issues in LXD backend#492
dmitry-lyfar merged 3 commits into
mainfrom
fix/lxd-backend

Conversation

@jonathan-conder
Copy link
Copy Markdown
Contributor

Description

Fixes some issues I noticed while working on #491:

  • If a base image download fails, concurrent downloads don't report the error.
  • Sometimes LXD clients aren't closed, or might be closed too early.
  • If a container's start command fails, the error message is limited to the exit code and doesn't show anything printed on stderr.

The last one is something I'm unsure about. It would have been helpful when working on #488, but it gives us very little control over the error message.

Self-review quick check

  • Make decisions that cost a lot to reverse explicit in the PR description.
  • Avoid nested conditions.
  • Delete dead code and redundant comments.
  • Normalise symmetries by sticking to doing identical things identically.
// one way to handle errors
if err := f(); err != nil {
   ...
}

// one way to handle multiple returns
val, err := f()
if err != nil {
   ...
}
...
  • Check that coupled code elements, files, and directories are adjacent. For example, test data is stored as close as possible to a test.
  • Put variable declaration and initialisation together.
  • Divide large expressions into digestable and self-explanatory ones. Use multiple variables if required.
  • Put a blank line between two logically different chunks of code.
  • Follow the style guide for new error messages.

Docs

  • I have checked and added or updated relevant documentation.
  • I have checked and added or updated relevant release notes.
  • I have included the technical author in the review.

Or:

  • I confirm the PR has no implications for documentation.

Previously only one call to waitDownloadOp would receive the error
placed in the channel. The others wait until the channel is closed,
receiving nil.
@jonathan-conder jonathan-conder self-assigned this Sep 18, 2025
@github-actions
Copy link
Copy Markdown

TICS Quality Gate

✔️ Passed

workshop

All conditions passed

See the results in the TICS Viewer

The following files have been checked for this project
  • internal/workshop/lxd/lxd_backend_project.go
  • internal/workshop/lxd/lxd_backend.go
  • internal/workshop/lxd/lxd_base_manager.go

Automatic-tests / code-coverage / TICS GitHub Action

@dmitry-lyfar dmitry-lyfar merged commit 3b9195f into main Sep 22, 2025
11 checks passed
@dmitry-lyfar dmitry-lyfar deleted the fix/lxd-backend branch September 22, 2025 00:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants