Skip to content

Add cgroupsPath validation#631

Merged
liangchenye merged 1 commit intoopencontainers:masterfrom
zhouhao3:cgroups-validation
May 9, 2018
Merged

Add cgroupsPath validation#631
liangchenye merged 1 commit intoopencontainers:masterfrom
zhouhao3:cgroups-validation

Conversation

@zhouhao3
Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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>
@zhouhao3 zhouhao3 force-pushed the cgroups-validation branch from 3078423 to 3e3094d Compare May 3, 2018 09:59
@liangchenye
Copy link
Copy Markdown
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