commit
7be6edaa60
13
spec.go
13
spec.go
|
@ -240,6 +240,9 @@ func loadSpec(cPath string) (spec *specs.Spec, err error) {
|
||||||
if err = json.NewDecoder(cf).Decode(&spec); err != nil {
|
if err = json.NewDecoder(cf).Decode(&spec); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
if err = validatePlatform(&spec.Platform); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
return spec, validateProcessSpec(&spec.Process)
|
return spec, validateProcessSpec(&spec.Process)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -254,3 +257,13 @@ func createLibContainerRlimit(rlimit specs.Rlimit) (configs.Rlimit, error) {
|
||||||
Soft: uint64(rlimit.Soft),
|
Soft: uint64(rlimit.Soft),
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func validatePlatform(platform *specs.Platform) error {
|
||||||
|
if platform.OS != runtime.GOOS {
|
||||||
|
return fmt.Errorf("target os %s mismatch with current os %s", platform.OS, runtime.GOOS)
|
||||||
|
}
|
||||||
|
if platform.Arch != runtime.GOARCH {
|
||||||
|
return fmt.Errorf("target arch %s mismatch with current arch %s", platform.Arch, runtime.GOARCH)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue