-
Notifications
You must be signed in to change notification settings - Fork 0
compute container's layer size #19
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
Conversation
a6814a3 to
e754dff
Compare
daemon/containerd/service.go
Outdated
| if err != nil { | ||
| return 0, 0, err | ||
| } | ||
| return size, size + virtualSize, nil |
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.
I went looking "why are we also including the image size here?" but it's just some odd thing from the past I guess 🤷♂️
| logrus.Errorf("Failed to compute size of container rootfs %v: %v", containerID, err) | ||
| return sizeRw, sizeRootfs | ||
| return sizeRw, sizeRootfs, nil |
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.
Looks like the old code didn't return the error if we failed to get the size; not sure why that was done (could've been to make sure that docker inspect also worked on a dead container); should we (for now) keep the same behaviour?
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.
Hmm.. not sure why it was; looking at this code, it looks like we're already returning early if there's no RWLayer 🤔 https://github.com/moby/moby/blob/7b9275c0da707b030e62c96b679a976f31f929d3/daemon/inspect.go#L187-L192
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.
Log was added in moby@77ae978 (but possibly because the function didn't have an error return; size was added in moby@a91b710 (no mention of error handling there)
cefb3ab to
6c51341
Compare
44d5f62 to
5cdf491
Compare
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
5cdf491 to
96c85f8
Compare
|
This one should be upstreamed together with #46 |
- What I did
implement GetContainerLayerSize using containerd snapshotter
container's RW layer (i.e active snapshot) size is available as a standard snapshotter API
container's virtual size isn't but can be computed as base image size (which we already have computation logic in place) + active snapshot size