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

Return correct error if CRIU binary is missing #9960

Merged
merged 1 commit into from May 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 11 additions & 4 deletions internal/cri/server/container_checkpoint_linux.go
Expand Up @@ -41,8 +41,6 @@ import (
ptypes "github.com/containerd/containerd/v2/protobuf/types"
"github.com/containerd/log"
v1 "github.com/opencontainers/image-spec/specs-go/v1"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"

"github.com/containerd/containerd/v2/client"
runtime "k8s.io/cri-api/pkg/apis/runtime/v1"
Expand Down Expand Up @@ -73,8 +71,17 @@ func (c *criService) CheckpointContainer(ctx context.Context, r *runtime.Checkpo
// This is the wrong error message and needs to be adapted once
// Kubernetes (the e2e_node/checkpoint) test has been changed to
// handle too old or missing CRIU error messages.
log.G(ctx).WithError(err).Errorf("Failed to checkpoint container %q", r.GetContainerId())
return nil, status.Errorf(codes.Unimplemented, "method CheckpointContainer not implemented")
errorMessage := fmt.Sprintf(
"CRIU binary not found or too old (<%d). Failed to checkpoint container %q",
Copy link
Member

Choose a reason for hiding this comment

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

suggestion:

errMsg := fmt.Sprintf("failed to checkpoint container %q", r.GetContainerId())

since the detail message is covered by err.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately Kubernetes depends on the error message. Changing it now requires Kubernetes changes again.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

podCriuVersion,
r.GetContainerId(),
)
log.G(ctx).WithError(err).Errorf(errorMessage)
return nil, fmt.Errorf(
"%s: %w",
errorMessage,
err,
)
}

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