Skip to content

Commit 218e2cf

Browse files
committed
Return correct error if CRIU binary is missing
For the first version of containerd's "Forensic Container Checkpointing" support the error message if the CRIU binary is not found was deliberately wrong to not break Kubernetes e2e_node tests. Now that the e2e_node tests have been adapted, containerd can return the correct error message. Signed-off-by: Adrian Reber <[email protected]>
1 parent 9fc0b64 commit 218e2cf

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

internal/cri/server/container_checkpoint_linux.go

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ import (
4141
ptypes "github.com/containerd/containerd/v2/protobuf/types"
4242
"github.com/containerd/log"
4343
v1 "github.com/opencontainers/image-spec/specs-go/v1"
44-
"google.golang.org/grpc/codes"
45-
"google.golang.org/grpc/status"
4644

4745
"github.com/containerd/containerd/v2/client"
4846
runtime "k8s.io/cri-api/pkg/apis/runtime/v1"
@@ -73,8 +71,17 @@ func (c *criService) CheckpointContainer(ctx context.Context, r *runtime.Checkpo
7371
// This is the wrong error message and needs to be adapted once
7472
// Kubernetes (the e2e_node/checkpoint) test has been changed to
7573
// handle too old or missing CRIU error messages.
76-
log.G(ctx).WithError(err).Errorf("Failed to checkpoint container %q", r.GetContainerId())
77-
return nil, status.Errorf(codes.Unimplemented, "method CheckpointContainer not implemented")
74+
errorMessage := fmt.Sprintf(
75+
"CRIU binary not found or too old (<%d). Failed to checkpoint container %q",
76+
podCriuVersion,
77+
r.GetContainerId(),
78+
)
79+
log.G(ctx).WithError(err).Errorf(errorMessage)
80+
return nil, fmt.Errorf(
81+
"%s: %w",
82+
errorMessage,
83+
err,
84+
)
7885
}
7986

8087
container, err := c.containerStore.Get(r.GetContainerId())

0 commit comments

Comments
 (0)