Skip to content

lxd/operations: Return failed operation state from wait endpoint - #18829

Closed
IzzaldinSamir wants to merge 1 commit into
canonical:mainfrom
IzzaldinSamir:fix-network-api
Closed

lxd/operations: Return failed operation state from wait endpoint#18829
IzzaldinSamir wants to merge 1 commit into
canonical:mainfrom
IzzaldinSamir:fix-network-api

Conversation

@IzzaldinSamir

Copy link
Copy Markdown

Root Cause

The wait endpoint commits to an HTTP 200 OK before blocking on the operation. When op.Wait returned an operation error, the handler attempted to render a second HTTP error response instead of returning the operation state. As a result, clients (like lxc network) interpreted failed asynchronous operations as successful because they received a 200 OK without the failure payload.

The Fix

Instead of checking the error from op.Wait(ctx), we now call op.Render() after the wait returns to fetch the actual final state of the operation (which includes failures and timeouts) and return it to the client via a SyncResponse.

Added regression coverage in test/suites/operations.sh to ensure duplicate network creations properly return the failure state.

Fixes #18715

Fixes canonical#18715

Signed-off-by: Izzaldin Samir <izzaldinsamir@gmail.com>
@0xSA7

0xSA7 commented Jul 31, 2026

Copy link
Copy Markdown

Hey @IzzaldinSamir!

If you closed this because of the failed DCO or CLA checks, no need to restart from scratch! That happens all the time with first contributions.
Just noticed a couple of CI checks was blocking the PR:

  • DCO Check Failed: Mismatch between git author name and Signed-off-by header

  • Canonical CLA: Requires a signed CLA.

@IzzaldinSamir

Copy link
Copy Markdown
Author

Hey @IzzaldinSamir!

If you closed this because of the failed DCO or CLA checks, no need to restart from scratch! That happens all the time with first contributions. Just noticed a couple of CI checks was blocking the PR:

  • DCO Check Failed: Mismatch between git author name and Signed-off-by header
  • Canonical CLA: Requires a signed CLA.

Hey @0xSA7, thanks for looking out! I actually caught a minor code duplication in my Go logic right after opening this, and since my browser editor was acting up with the Git Amend command for the DCO signature, I just spun up a clean branch and recreated it over at #18830. Everything is green and good to go now. I really appreciate the help though!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

lxc network gets 200 from API when action failed

2 participants