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
runtime: merged ValidCgroupPath method #8931
runtime: merged ValidCgroupPath method #8931
Conversation
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.
Thanks @yaoyinnan! One comment here.
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.
Lgtm, thanks @yaoyinnan!
/test |
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.
Thx @yaoyinnan could you please split the PR into more one commits to make it clearer ? IMO, the code related to test should be moved into one commit ?
// see https://github.com/opencontainers/runtime-spec/blob/master/config-linux.md#cgroups-path | ||
func ValidCgroupPathV1(path string, systemdCgroup bool) (string, error) { | ||
func ValidCgroupPath(path string, v2 bool) (string, error) { |
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 logic was changed due to systemdCgroup
removal
- before: the function throws an error if
systemdCgroup == true
and the path is not in the format of systemd cgroup. - now: giving a new path without any errors.
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.
@justxuewei Thank you for your review, this issue is indeed worthy of discussion.
The IsSystemdCgroup() is repeated. When calling the ValidCgroupPath() method, the incoming systemdCgroup is obtained through IsSystemdCgroup(path).
This logic seems to be intended to handle the following situation: when calling the ValidCgroupPath()
, the parameter systemdCgroup==true
is actively passed in, but in fact, IsSystemdCgroup(path)
is judged to be false
inside the function.
I'm not sure if I want to keep this design from before, please give advice, thanks.
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.
IsSystemdCgroup(path)
is judged to be false inside the function.
I still think they are different. Let me list all possible cases here.
index | path | systemdCgroup | result |
---|---|---|---|
1 | systemd | true | (origin path, nil) |
2 | systemd | false | (origin path, nil) |
3 | non-systemd | true | ("", error) |
4 | non-systemd | false | (new path, nil) |
Case 3 means I expect the path is in the format of systemd, but it isn't actually. Then, an error is required to be thrown. The case is unreachable if systemdCgroup
is removed. In other words, no errors will be thrown in the current ValidCgroupPath()
. Wdyt?
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.
You are right
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 fixed this question and the email issue.
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.
Block this PR mergence until the above comment is addressed.
Btw, your email in |
9d09a35
to
b11419c
Compare
55e61c7
to
d535f6f
Compare
/test |
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.
Lgtm, thanks!
Merged ValidCgroupPath method to handle cgroupv1 and cgroupv2. Fixes: kata-containers#8930 Signed-off-by: yaoyinnan <35447132+yaoyinnan@users.noreply.github.com>
Modify ValidCgroupPath unit test. Fixes: kata-containers#8930 Signed-off-by: yaoyinnan <35447132+yaoyinnan@users.noreply.github.com>
d535f6f
to
b0b8523
Compare
/test |
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.
Thx @yaoyinnan LGTM
Merged ValidCgroupPath method and modified unit tests.
Fixes: #8930