Open ahadas opened 2 years ago
This is also helps to avoid disconnection of idle connections (#71) if a client is using multiple connections and is waiting util the initial EXTENTS request completes.
In imageio client this does not happen since we send the first EXTENTS request before creating the other connections, as part of initial validation. But other clients may use different design and hit this issue.
The http backed need to know the image size for validating requests to the server. Since we did not have a way to get the size from the server, we implemented size() using extents request, and cached the extents for future calls.
Using extents to get the size is inefficient, and may take lot of time on large images on fragmented file systems.
Add the image size the OPTIONS response:
Example request:
OPTIONS /images/tiket-id
Return json with:
The size should be the effective size that can downloaded or uploaded, using the same logic used to validate range requests.
I think we need to add more info that can be helpful for the client, for example:
This maps nicely to the NBD protocol handshake, reporting all he info about the remote disk.
The http backend should be updated to use the size reported in OPTIONS instead of doing a slow extent request to get the size.
Original bug: https://bugzilla.redhat.com/1924945