-
Story
-
Resolution: Done
-
Normal
-
2025.2 (Flamingo)
-
None
Scope
Implement all the code changes to pass image size to glance API and make it ready for review in upstream.
Acceptance criteria
- Patch code should for review in upstream
- It should have all unit and/or tempest tests if required
Here we will read the size passed from glanceclient or any request source via header `x-openstack-image-size` and pass it to the designated storage backend. This approach will help prevent resize-on-write operations for Cinder and RBD backends and enable the use of the multipart upload feature for the S3 backend. After completing the staging process, we will compare the actual image size to the size provided by the user. If there is a discrepancy, we will reject the image staging, remove the data from the backend, and return an appropriate error message to the user. Additionally, we will log a warning that aligns with the existing checks for image disk format and hash.
If the image size is not included in the request header, we will have no option but to allow the storage backends to perform resize-on-write operations or to utilize the single-part upload feature for the S3 backend.
For asynchronous operations (import APIs), such as the glance-direct and web-download import methods, we already gather data in a local staging area before transferring it to the backend. We will ensure that the image size is set before starting the import operation to avoid these resize operations.