From 87f591a697782e4d28c51f940739f6024dc398e1 Mon Sep 17 00:00:00 2001 From: fupan Date: Mon, 19 Nov 2018 11:36:06 +0800 Subject: [PATCH] containerd-shim-kata-v2: add the service Connect support Add the Connect api to get the shim's info. Signed-off-by: fupan --- containerd-shim-v2/service.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/containerd-shim-v2/service.go b/containerd-shim-v2/service.go index 1f42cf2a7c..bde337599b 100644 --- a/containerd-shim-v2/service.go +++ b/containerd-shim-v2/service.go @@ -534,7 +534,14 @@ func (s *service) Checkpoint(ctx context.Context, r *taskAPI.CheckpointTaskReque // Connect returns shim information such as the shim's pid func (s *service) Connect(ctx context.Context, r *taskAPI.ConnectRequest) (*taskAPI.ConnectResponse, error) { - return nil, errdefs.ErrNotImplemented + s.Lock() + defer s.Unlock() + + return &taskAPI.ConnectResponse{ + ShimPid: s.pid, + //Since kata cannot get the container's pid in VM, thus only return the shim's pid. + TaskPid: s.pid, + }, nil } func (s *service) Shutdown(ctx context.Context, r *taskAPI.ShutdownRequest) (*ptypes.Empty, error) {