Skip to content

Commit

Permalink
lxd/image: Acquire image lock for uploaded images
Browse files Browse the repository at this point in the history
We have to do this pretty late in the upload process because we can't
guarantee that the client has sent a fingerprint via X-LXD-fingerprint.

Signed-off-by: Wesley Hershberger <[email protected]>
  • Loading branch information
MggMuggins committed Sep 13, 2024
1 parent 4c7517c commit c5d9021
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lxd/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -839,6 +839,13 @@ func getImgPostInfo(s *state.State, r *http.Request, builddir string, project st
}
}

unlock, err := imageOperationLock(info.Fingerprint)
if err != nil {
return nil, err
}

defer unlock()

info.Architecture = imageMeta.Architecture
info.CreatedAt = time.Unix(imageMeta.CreationDate, 0)

Expand Down

0 comments on commit c5d9021

Please sign in to comment.