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

libct/cgroup/utils: fix GetCgroupMounts(all=true) #2689

Merged
merged 1 commit into from
Dec 8, 2020

Conversation

kolyshkin
Copy link
Contributor

The all argument was introduced by commit f557996 (PR #1049) specifically
for use by cAdvisor (see google/cadvisor#1476), but there were no test cases added,
so it was later accidentally broken by 5ee0648 (#1817) which started incrementing
numFound unconditionally.

Fix this (by not checking numFound when all is true), and add a
simple test case to avoid future regressions.

PS It appears to be that cadvisor is the only user of all=true functionality.
If we could eliminate it, we would remove all=true entirely, but it's not clear
how to do that. I sincerely hope one day cgroup v1 is going away entirely,
including all this code.

AkihiroSuda
AkihiroSuda previously approved these changes Nov 24, 2020
@AkihiroSuda
Copy link
Member

@mrunalp PTAL

The `all` argument was introduced by commit f557996 specifically
for use by cAdvisor (see [1]), but there were no test cases added,
so it was later broken by 5ee0648 which started incrementing
numFound unconditionally.

Fix this (by not checking numFound in case all is true), and add a
simple test case to avoid future regressions.

[1] google/cadvisor#1476

Signed-off-by: Kir Kolyshkin <[email protected]>
@kolyshkin
Copy link
Contributor Author

Rebased to include new CI checks; no changes to the code

@dqminh
Copy link
Contributor

dqminh commented Dec 7, 2020

LGTM.

But i also don't see why cadvisor needs to use all and filter the cgroup out by itself, perhaps it can just use the current API and things will work (?)

@kolyshkin
Copy link
Contributor Author

But i also don't see why cadvisor needs to use all and filter the cgroup out by itself, perhaps it can just use the current API and things will work (?)

It's complicated :-\ I tried to get rid of it but I'm afraid of re-introducing google/cadvisor#1461

@AkihiroSuda AkihiroSuda merged commit 544048b into opencontainers:master Dec 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants