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

Fix system df negative reclaimable size bug #25506

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Luap99
Copy link
Member

@Luap99 Luap99 commented Mar 7, 2025

Does this PR introduce a user-facing change?

Fixed a bug in podman system df where a negative size for RECLAIMABLE was shown.

@openshift-ci openshift-ci bot added release-note do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Mar 7, 2025
@Luap99 Luap99 force-pushed the disk-usage branch 2 times, most recently from cb2969f to 897ad6a Compare March 11, 2025 19:16
@Luap99 Luap99 marked this pull request as ready for review March 11, 2025 19:19
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 11, 2025
Comment on lines 150 to 151
is "$output" ".*1[0-9].[0-9]\\+MB.*3.[0-9]\\+kB\\s\\+2.*" "Shared and Unique Size"
is "$output" ".*1[0-9].[0-9]\\+MB.*6.[0-9]\\+kB\\s\\+0.*" "Shared and Unique Size"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do these two regexes check? Wouldn't it be better to use assert instead of is?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assert or is should be the same here, because the test is using is overall I have opted to keep using is for consistency.

The sizes are non stable (metadat, different storage drivers, etc...) so I have opted to use a regex range that makes sense.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
is "$output" ".*1[0-9].[0-9]\\+MB.*3.[0-9]\\+kB\\s\\+2.*" "Shared and Unique Size"
is "$output" ".*1[0-9].[0-9]\\+MB.*6.[0-9]\\+kB\\s\\+0.*" "Shared and Unique Size"
# regex match: SHARED SIZE | UNIQUE SIZE | CONTAINERS
is "$output" ".*[1-9]\\d*\\.[0-9]\\+MB\\s\\+[1-9]\\d*\\.[0-9]\\+kB\\s\\+2.*" "Shared and Unique Size"
is "$output" ".*[1-9]\\d*\\.[0-9]\\+MB\\s\\+[1-9]\\d*\\.[0-9]\\+kB\\s\\+0.*" "Shared and Unique Size"

I would use this regex, which is preserved even when updating and resizing the image.

Maybe only one line could be checked. Because there is only a difference between the container numbers.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes that is an option if we want to allow all numbers, it certainly should make it more future proof on image changes.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that would be better.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok used assert and single quotes which hopefully should make the regex more readable, also I did not add 1-9 extra check as this seems like more complications that don't add any test value.

Luap99 added 3 commits March 12, 2025 19:49
Includes my DiskUsage() changes.

Signed-off-by: Paul Holzinger <[email protected]>
Our calculation is just wrong and the way the entire API is designed it
cannot work. This is the same interface as docker is using and they have
the same bug there. So simply document this as known problem, in case
users complain we at least have something to point to.

An actual fix might be possible but not without reworking the full API
and because this is exposed in the docker compat and libpod REST API we
cannot really change it.

Signed-off-by: Paul Holzinger <[email protected]>
Copy link
Member

@Honny1 Honny1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
/approve

Copy link
Contributor

openshift-ci bot commented Mar 12, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Honny1, Luap99

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@TomSweeneyRedHat
Copy link
Member

LGTM

@TomSweeneyRedHat
Copy link
Member

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Mar 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. release-note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants