Skip to content

show response body for clone#1040

Merged
boddumanohar merged 2 commits into
mainfrom
response-body-clone
May 14, 2026
Merged

show response body for clone#1040
boddumanohar merged 2 commits into
mainfrom
response-body-clone

Conversation

@boddumanohar
Copy link
Copy Markdown
Member

@boddumanohar boddumanohar commented May 13, 2026

Currently the V2 volume clone endpoint:

GET /api/v2/clusters/{cluster_id}/storage-pools/{pool_id}/volumes/{lvol_id}/clone

can return HTTP 500 because it directly returns:

return lvol_controller.clone_lvol(...)

clone_lvol() returns a tuple, for example (new_lvol_uuid, False) on success or (False, error) on failure, while the route is annotated as:

def clone(...) -> bool:

FastAPI tries to serialize/validate that tuple as a boolean and raises ResponseValidationError.

The these changes fixes this by unpacking the tuple, handling the error case explicitly, and returning the created clone using the same V2 creation pattern:

HTTP 201 Created
Location: /api/v2/clusters/<cluster_id>/storage-pools/<pool_id>/volumes/<new_clone_volume_id>/
Body: empty

@boddumanohar boddumanohar force-pushed the response-body-clone branch from 420077f to 903dcc2 Compare May 14, 2026 03:37
@boddumanohar boddumanohar force-pushed the response-body-clone branch from 903dcc2 to 14c9b3b Compare May 14, 2026 16:37
@boddumanohar boddumanohar marked this pull request as ready for review May 14, 2026 17:49
@boddumanohar boddumanohar merged commit b2dd386 into main May 14, 2026
9 checks passed
@boddumanohar boddumanohar deleted the response-body-clone branch May 14, 2026 18:52
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