sandbox_run: Log a warning if we can't find a slice
Don't fail hard if we can't find a slice.
@@ -390,8 +390,12 @@ func (s *Server) runPodSandbox(ctx context.Context, req *pb.RunPodSandboxRequest
// read in the memory limit from the memory.limit_in_bytes file
fileData, err := ioutil.ReadFile(filepath.Join(cgroupMemorySubsystemMountPath, slicePath, "memory.limit_in_bytes"))
if err != nil {
+ if os.IsNotExist(err) {
+ logrus.Warnf("Failed to find memory.limit_in_bytes for slice: %q", cgroupParent)
+ } else {
return nil, errors.Wrapf(err, "error reading memory.limit_in_bytes file for slice %q", cgroupParent)
}
+ } else {
// strip off the newline character and convert it to an int
strMemory := strings.TrimRight(string(fileData), "\n")
if strMemory != "" {
@@ -404,6 +408,7 @@ func (s *Server) runPodSandbox(ctx context.Context, req *pb.RunPodSandboxRequest
return nil, fmt.Errorf("pod set memory limit %v too low; should be at least %v", memoryLimit, minMemoryLimit)
}
}
+ }
} else {
if strings.HasSuffix(path.Base(cgroupParent), ".slice") {
return nil, fmt.Errorf("cri-o configured with cgroupfs cgroup manager, but received systemd slice as parent: %s", cgroupParent)
