Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lxd/image: Acquire image lock for uploaded images #14100

Merged

Conversation

MggMuggins
Copy link
Contributor

@MggMuggins MggMuggins commented Sep 13, 2024

Fixes #13855

imageOperationLocks are not being taken at the start of a POST /1.0/images because the image fingerprint can't be trusted until the file has been uploaded (see lxd/images/go). This makes it fairly easy to forget to take a lock at all.

@MggMuggins MggMuggins force-pushed the acquire-lock-during-image-upload branch from c5d9021 to 42e58e1 Compare September 16, 2024 21:39
Attempt to reduce code duplication.

This will allow me to acquire the lock in one place
instead of two (next commit).

Signed-off-by: Wesley Hershberger <[email protected]>
Fixes canonical#13855

This needs to happen late in the upload process because we need to verify
the uploaded image's fingerprint before acquiring a lock.

Signed-off-by: Wesley Hershberger <[email protected]>
@MggMuggins MggMuggins force-pushed the acquire-lock-during-image-upload branch from 42e58e1 to 8a59f7f Compare September 16, 2024 22:10
@MggMuggins MggMuggins marked this pull request as ready for review September 17, 2024 04:07
@tomponline tomponline merged commit aac5e44 into canonical:main Sep 17, 2024
30 checks passed
@MggMuggins MggMuggins deleted the acquire-lock-during-image-upload branch September 17, 2024 14:05
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.

Local image import does not acquire image lock
2 participants