-
Notifications
You must be signed in to change notification settings - Fork 18.7k
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
Add support for shared-size
parameter for images queries
#42531
Conversation
Changing that boolean was my first idea, but (I think I left some notes on that on the internal ticket, but may have forgotten); we're mostly interested in the Having a quick look, I think we should modify the logic in Lines 189 to 218 in 1ba54a5
Looking at that code, I think there's an issue; the code was written for Line 46 in 1ba54a5
However, the Even if we would put the calculation at the start of the loop; Line 93 in 1ba54a5
It looks like Lines 64 to 68 in 1ba54a5
|
1095704
to
3f219de
Compare
bd82abc
to
200fab4
Compare
Updated the OP, added 200fab4 , which is based on top of #42550 @thaJeztah I suppose the safest way to handle this would be to make this feature opt-in, do you agree? I think we could add a |
shared-size
parameter for images queries
Done in 0c51846 |
dd61261
to
9a02695
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't forget to also update
Lines 7185 to 7192 in 2bd46ed
parameters: | |
- name: "all" | |
in: "query" | |
description: "Show all images. Only images from a final layer (no children) are shown by default." | |
type: "boolean" | |
default: false | |
- name: "filters" | |
in: "query" |
And to add a mention of the new query-arg in https://github.com/moby/moby/blob/2bd46ed7e5a016f21b9259cec269340420fa7a63/docs/api/version-history.md
cdaf727
to
c99a946
Compare
I was having trouble understanding the motivation for this change (and feeling like I should already understand what's going on here) and discussed with @thaJeztah, and he provided the following explanation which helped me understand the intent much better:
Can we add something simple like that to explain the motivation to the PR description/commit? 🙏 😇 |
Added
to the OP, please let me know if you think this is not enough and whether we should record this in git history as well, for example. |
Adding to git history, as part of the commit message is always good to have.
That said, this PR likely will need a rebase after the other PR is merged, so it's ok to do it at that point
… On 28 Jun 2021, at 18:34, Roman Volosatovs ***@***.***> wrote:
I was having trouble understanding the motivation for this change (and feeling like I should already understand what's going on here) and discussed with @thaJeztah, and he provided the following explanation which helped me understand the intent much better:
the system df command reuses the existing backend, but passes the "with extra attributes" argument, to calculate the shared size of images (and number of containers that use an image)
The PR is to expose the shared size option on the /images/json (docker images / docker image ls) endpoint, so that the information can also be retrieved outside of docker system df
Can we add something simple like that to explain the motivation to the PR description/commit? pray innocent
Added
The reasoning for this change is to be able to query image shared size without having to rely on the more heavyweight /system/df endpoint.
to the OP, please let me know if you think this is not enough and whether we should record this in git history as well, for example.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
4f0ed6d
to
7a53506
Compare
0313854
to
185ac93
Compare
Note: this should also update the default API version; we can merge #42063 before this once review progresses (I'll rebase that one, so that you can possibly include that in this PR; we can merge it separately or as part of this one (I somewhat prefer separately to make it easier to find back, but not either way would be fine) |
@@ -26,7 +26,11 @@ func (daemon *Daemon) SystemDiskUsage(ctx context.Context) (*types.DiskUsage, er | |||
} | |||
|
|||
// Get all top images with extra attributes | |||
allImages, err := daemon.imageService.Images(filters.NewArgs(), false, true) | |||
allImages, err := daemon.imageService.Images(ctx, types.ImageListOptions{ | |||
Filters: filters.NewArgs(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not for this PR, but wondering if we should change Filters
to be a pointer, so that it can be left nil
if no filtering is used
Weird; Swagger validation is for some reason failing on a non-related change;
Looks like it complains about the empty description, but no clue why it fails on this PR (and not on other ones); Lines 1304 to 1318 in 7b9275c
|
opened #42583 to update the swagger files 🤷♂️ |
Yes, saw that as well, but assumed that is a known issue! Thanks for the fix! |
185ac93
to
7d77aea
Compare
7d77aea
to
e98db24
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good (left some thoughts/feedback inline, but no strong "blockers").
If we go ahead with this PR, I suggest we merge #42063 first (separately), to make the API version update more easily discoverable (then rebase this PR)
Failure on Windows is Let me kick CI |
180445d
to
9e4cbf3
Compare
Blocked by #42063 (will rebase and rerequest review once it is merged) |
9e4cbf3
to
ea8c30e
Compare
ea8c30e
to
ff91bc9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@tianon @tonistiigi PTAL |
This makes it easier to add more options to the backend without having to change the signature. While we're changing the signature, also adding a context.Context, which is not currently used, but probably should be at some point. Signed-off-by: Roman Volosatovs <[email protected]>
The reasoning for this change is to be able to query image shared size without having to rely on the more heavyweight `/system/df` endpoint. Signed-off-by: Roman Volosatovs <[email protected]>
ff91bc9
to
2af9bd3
Compare
- What I did
Guard shared size computations with
shared-size
boolean URL parameter.The reasoning for this change is to be able to query image shared size without having to rely on the more heavyweight
/system/df
endpoint.- How I did it
Add an additional boolean parameter to
ImageService.Images
and add a URL parameter to the API endpoint mapping to it's value.On a fast search over the codebase I did not see another URL parameter consisting of 2 words, so not sure about the naming convention, if there is one - went for kebab case.
- How to verify it
Also with filtering:
- Description for the changelog
/images
endpoint now supports booleanshared-size
URL parameter, which enables shared size computation when set