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

[1.0] libct/cg/sd/v1: fix freezeBeforeSet (alt 2) #3167

Merged
merged 3 commits into from Aug 20, 2021

Conversation

kolyshkin
Copy link
Contributor

@kolyshkin kolyshkin commented Aug 17, 2021

A backport of #3166 to 1.0 branch. Original description follows.


This is a combo of #3143, #3151, and #3161, which aims to be both fast and correct for all use cases.

From #3143 -- fixes to getting and checking device properties;
From #3151 -- fast(er) path in freezeBeforeSet (in case devices.list is empty we can skip getting unit properties);
From #3161 -- SkipFreezeOnSet knob for kubernetes.
From #3148 -- test cases (those are also cherry-picked in #3143)

Aimed to fix kubernetes/kubernetes#104280 (once we backport, release 1.0.2, and vendor it to kubernetes)

@kolyshkin kolyshkin added area/cgroupv1 area/go-api libcontainer Go API area/systemd backport/1.0-pr A backport to 1.0.x release. labels Aug 17, 2021
@kolyshkin kolyshkin mentioned this pull request Aug 17, 2021
@kolyshkin kolyshkin marked this pull request as draft August 17, 2021 22:44
@kolyshkin
Copy link
Contributor Author

Draft until #3166 is merged.

odinuge and others added 3 commits August 18, 2021 13:01
This fixes the behavior intended to avoid freezing containers/control
groups without it being necessary. This is important for end users of
libcontainer who rely on the behavior of no freeze.

The previous implementation would always get error trying to get
DevicePolicy from the Unit via dbus, since the Unit interface doesn't
contain DevicePolicy.

Signed-off-by: Odin Ugedal <odin@uged.al>
(cherry picked from commit 4104367)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Add a test for freezeBeforeSet, checking various scenarios including
those that were failing before the fix in the previous commit.

[v2: add more cases, add a check before creating a unit.]

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
(cherry picked from commit fec49f2)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This is helpful to kubernetes in cases it knows for sure that the freeze
is not required (since it created the systemd unit with no device
restrictions).

As the code is trivial, no tests are required.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
(cherry picked from commit 9a095e4)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
@kolyshkin kolyshkin marked this pull request as ready for review August 19, 2021 18:40
@kolyshkin
Copy link
Contributor Author

#3166 is merged; this is no longer a draft

@kolyshkin kolyshkin requested a review from cyphar August 19, 2021 21:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/cgroupv1 area/go-api libcontainer Go API area/systemd backport/1.0-pr A backport to 1.0.x release.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants