-
Notifications
You must be signed in to change notification settings - Fork 144
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
Validate_linux: Modify the returned error #601
Conversation
@@ -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)) |
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.
+1
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.
validate/validate_linux.go
Outdated
@@ -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)) |
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.
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'
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.
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>
58a4266
to
e99b47e
Compare
Signed-off-by: Zhou Hao zhouhao@cn.fujitsu.com