-
Notifications
You must be signed in to change notification settings - Fork 141
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
Conversation
4bc5e81
to
3078423
Compare
@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) | ||
} |
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.
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) | ||
} |
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.
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) | ||
} |
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.
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) | ||
} |
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.
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) | ||
} |
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.
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) | ||
} |
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.
the last place.
Besides these, it looks good to me.
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.
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 <[email protected]>
3078423
to
3e3094d
Compare
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 [email protected]