From 8c95b7569dc6083d51a19bf7fab02c861fff8c5c Mon Sep 17 00:00:00 2001 From: fupan Date: Mon, 19 Nov 2018 11:33:09 +0800 Subject: [PATCH] containerd-shim-kata-v2: add the service Pids support Add the Pids api support to get the processes pids running in the pod. Signed-off-by: fupan --- containerd-shim-v2/service.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/containerd-shim-v2/service.go b/containerd-shim-v2/service.go index 4923828b78..c134ce7d54 100644 --- a/containerd-shim-v2/service.go +++ b/containerd-shim-v2/service.go @@ -484,8 +484,19 @@ func (s *service) Kill(ctx context.Context, r *taskAPI.KillRequest) (*ptypes.Emp } // Pids returns all pids inside the container +// Since for kata, it cannot get the process's pid from VM, +// thus only return the Shim's pid directly. func (s *service) Pids(ctx context.Context, r *taskAPI.PidsRequest) (*taskAPI.PidsResponse, error) { - return nil, errdefs.ErrNotImplemented + var processes []*task.ProcessInfo + + pInfo := task.ProcessInfo{ + Pid: s.pid, + } + processes = append(processes, &pInfo) + + return &taskAPI.PidsResponse{ + Processes: processes, + }, nil } // CloseIO of a process