Skip to content

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

Merged
AkihiroSuda merged 1 commit intoopencontainers:masterfrom
kolyshkin:get-cgroup-mounts-all
Dec 8, 2020
Merged

libct/cgroup/utils: fix GetCgroupMounts(all=true)#2689
AkihiroSuda merged 1 commit intoopencontainers:masterfrom
kolyshkin:get-cgroup-mounts-all

Conversation

@kolyshkin
Copy link
Copy Markdown
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
Copy Markdown
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 <kolyshkin@gmail.com>
@kolyshkin
Copy link
Copy Markdown
Contributor Author

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

@dqminh
Copy link
Copy Markdown
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
Copy Markdown
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