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

Add cgroupsPath validation #631

Merged
merged 1 commit into from
May 9, 2018

Conversation

zhouhao3
Copy link

Implement the following specerror:

CgroupsAbsPathRelToMount: In the case of an absolute path (starting with /), the runtime MUST take the path to be relative to the cgroups mount point.

CgroupsPathAttach: If the value is specified, the runtime MUST consistently attach to the same place in the cgroups hierarchy given the same value of cgroupsPath.

Signed-off-by: Zhou Hao zhouhao@cn.fujitsu.com

@zhouhao3
Copy link
Author

zhouhao3 commented May 3, 2018

@liangchenye PTAL

if _, err := os.Stat(path); err != nil {
if os.IsNotExist(err) {
return nil, specerror.NewError(specerror.CgroupsAbsPathRelToMount, fmt.Errorf("In the case of an absolute path, the runtime MUST take the path to be relative to the cgroups mount point"), rspec.Version)
}
Copy link
Member

Choose a reason for hiding this comment

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

return nil, err in case of getting other error?

if _, err := os.Stat(path); err != nil {
if os.IsNotExist(err) {
return nil, specerror.NewError(specerror.CgroupsAbsPathRelToMount, fmt.Errorf("In the case of an absolute path, the runtime MUST take the path to be relative to the cgroups mount point"), rspec.Version)
}
Copy link
Member

Choose a reason for hiding this comment

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

same, return error in case of other error.

if _, err := os.Stat(path); err != nil {
if os.IsNotExist(err) {
return nil, specerror.NewError(specerror.CgroupsAbsPathRelToMount, fmt.Errorf("In the case of an absolute path, the runtime MUST take the path to be relative to the cgroups mount point"), rspec.Version)
}
Copy link
Member

Choose a reason for hiding this comment

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

return error in case of other error

if _, err := os.Stat(path); err != nil {
if os.IsNotExist(err) {
return nil, specerror.NewError(specerror.CgroupsAbsPathRelToMount, fmt.Errorf("In the case of an absolute path, the runtime MUST take the path to be relative to the cgroups mount point"), rspec.Version)
}
Copy link
Member

Choose a reason for hiding this comment

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

same here

if _, err := os.Stat(path); err != nil {
if os.IsNotExist(err) {
return nil, specerror.NewError(specerror.CgroupsAbsPathRelToMount, fmt.Errorf("In the case of an absolute path, the runtime MUST take the path to be relative to the cgroups mount point"), rspec.Version)
}
Copy link
Member

Choose a reason for hiding this comment

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

and here

if _, err := os.Stat(path); err != nil {
if os.IsNotExist(err) {
return nil, specerror.NewError(specerror.CgroupsAbsPathRelToMount, fmt.Errorf("In the case of an absolute path, the runtime MUST take the path to be relative to the cgroups mount point"), rspec.Version)
}
Copy link
Member

Choose a reason for hiding this comment

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

the last place.
Besides these, it looks good to me.

Copy link
Author

Choose a reason for hiding this comment

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

updated, PTAL.

Implement the following specerror:

CgroupsAbsPathRelToMount: In the case of an absolute path (starting with `/`), the runtime MUST take the path to be relative to the cgroups mount point.

 CgroupsPathAttach: If the value is specified, the runtime MUST consistently attach to the same place in the cgroups hierarchy given the same value of `cgroupsPath`.

Signed-off-by: Zhou Hao <zhouhao@cn.fujitsu.com>
@liangchenye
Copy link
Member

liangchenye commented May 9, 2018

LGTM

Approved with PullApprove

@liangchenye liangchenye mentioned this pull request May 9, 2018
44 tasks
@liangchenye liangchenye merged commit 14d1be7 into opencontainers:master May 9, 2018
@zhouhao3 zhouhao3 deleted the cgroups-validation branch May 10, 2018 01:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants