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

runtime: merged ValidCgroupPath method #8931

Merged

Conversation

yaoyinnan
Copy link
Member

Merged ValidCgroupPath method and modified unit tests.

Fixes: #8930

@katacontainersbot katacontainersbot added the size/large Task of significant size label Jan 26, 2024
Copy link
Member

@justxuewei justxuewei left a 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.

Copy link
Member

@justxuewei justxuewei left a comment

Choose a reason for hiding this comment

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

Lgtm, thanks @yaoyinnan!

@justxuewei
Copy link
Member

/test

Copy link
Contributor

@Apokleos Apokleos left a 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) {
Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member

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?

Copy link
Member Author

Choose a reason for hiding this comment

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

You are right

Copy link
Member Author

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.

Copy link
Member

@justxuewei justxuewei left a 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.

@justxuewei
Copy link
Member

Btw, your email in sign-off-by is incorrect. You should take a look at this as well.

@yaoyinnan yaoyinnan force-pushed the 8930/feat/merge-ValidCgroupPath branch from 9d09a35 to b11419c Compare January 31, 2024 03:56
@yaoyinnan yaoyinnan force-pushed the 8930/feat/merge-ValidCgroupPath branch 2 times, most recently from 55e61c7 to d535f6f Compare January 31, 2024 04:47
@yaoyinnan
Copy link
Member Author

/test

Copy link
Member

@justxuewei justxuewei left a 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>
@yaoyinnan yaoyinnan force-pushed the 8930/feat/merge-ValidCgroupPath branch from d535f6f to b0b8523 Compare January 31, 2024 06:37
@yaoyinnan
Copy link
Member Author

/test

Copy link
Contributor

@Apokleos Apokleos left a comment

Choose a reason for hiding this comment

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

Thx @yaoyinnan LGTM

@Apokleos Apokleos merged commit cf26c16 into kata-containers:main Feb 1, 2024
282 of 295 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ok-to-test size/large Task of significant size
Projects
None yet
Development

Successfully merging this pull request may close these issues.

runtime: merged ValidCgroupPath method
4 participants