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

Validate_linux: Modify the returned error #601

Merged
merged 1 commit into from
Mar 14, 2018

Conversation

zhouhao3
Copy link

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

@@ -180,7 +180,7 @@ func (v *Validator) CheckLinux() (errs error) {
}

if _, exists := devTypeList[devID]; exists {
logrus.Warnf("type:%s, major:%d and minor:%d for linux devices is duplicated", device.Type, device.Major, device.Minor)
logrus.Warnf("%v", specerror.NewError(specerror.DevicesErrorOnDup, fmt.Errorf("type:%s, major:%d and minor:%d for linux devices is duplicated", device.Type, device.Major, device.Minor), 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.

+1

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.

@@ -94,7 +94,7 @@ func (v *Validator) CheckLinux() (errs error) {
for index := 0; index < len(v.spec.Linux.Devices); index++ {
device := v.spec.Linux.Devices[index]
if !deviceValid(device) {
errs = multierror.Append(errs, fmt.Errorf("device %v is invalid", device))
errs = multierror.Append(errs, specerror.NewError(specerror.DevicesAvailable, fmt.Errorf("device %v is invalid", device), 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.

I think it is not 'DevicesAvailable' error, it is simply 'device is invalid'.
DevicesAvailable is done here: 'https://github.com/opencontainers/runtime-tools/blob/master/cmd/runtimetest/main.go#L437'

Copy link
Member

Choose a reason for hiding this comment

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

BTW, the 'deviceValid' function should move to validate_linux.go.
It might be in another PR.

Signed-off-by: Zhou Hao <zhouhao@cn.fujitsu.com>
@zhouhao3 zhouhao3 force-pushed the validate-linux-fix branch from 58a4266 to e99b47e Compare March 14, 2018 02:14
@liangchenye
Copy link
Member

liangchenye commented Mar 14, 2018

LGTM

Approved with PullApprove

@liangchenye liangchenye merged commit 36891b9 into opencontainers:master Mar 14, 2018
@zhouhao3 zhouhao3 deleted the validate-linux-fix branch March 14, 2018 02:24
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