Skip to content

Commit

Permalink
lxd: Properly forward rebuild requests
Browse files Browse the repository at this point in the history
Signed-off-by: Stephane Graber <stgraber@stgraber.org>
  • Loading branch information
gabrielmougard committed Oct 12, 2023
1 parent d2067ea commit b3629bc
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lxd/instance_rebuild.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,21 @@ func instanceRebuildPost(d *Daemon, r *http.Request) response.Response {
return response.BadRequest(fmt.Errorf("Invalid instance name"))
}

instanceType, err := urlInstanceTypeDetect(r)
if err != nil {
return response.SmartError(err)
}

// Handle requests targeted to a container on a different node
resp, err := forwardedResponseIfInstanceIsRemote(s, r, targetProjectName, name, instanceType)
if err != nil {
return response.SmartError(err)
}

if resp != nil {
return resp
}

// Parse the request
req := api.InstanceRebuildPost{}
err = json.NewDecoder(r.Body).Decode(&req)
Expand Down

0 comments on commit b3629bc

Please sign in to comment.