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 <lifupan@gmail.com>
This commit is contained in:
fupan 2018-11-19 11:33:09 +08:00
parent 709bc9aa12
commit 8c95b7569d

View File

@ -484,8 +484,19 @@ func (s *service) Kill(ctx context.Context, r *taskAPI.KillRequest) (*ptypes.Emp
} }
// Pids returns all pids inside the container // 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) { 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 // CloseIO of a process