Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
virtcontainers: agent: implement kata agent processListContainer
Browse files Browse the repository at this point in the history
processListContainer is called by the ps command implementation to
list the processes running inside a containers, this patch implements
this function in the kata agent

fixes #129

Signed-off-by: Julio Montes <[email protected]>
  • Loading branch information
Julio Montes committed Apr 18, 2018
1 parent a85656b commit 4fc9740
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion virtcontainers/kata_agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -871,7 +871,23 @@ func (k *kataAgent) killContainer(sandbox Sandbox, c Container, signal syscall.S
}

func (k *kataAgent) processListContainer(sandbox Sandbox, c Container, options ProcessListOptions) (ProcessList, error) {
return nil, nil
req := &grpc.ListProcessesRequest{
ContainerId: c.id,
Format: options.Format,
Args: options.Args,
}

resp, err := k.sendReq(req)
if err != nil {
return nil, err
}

processList, ok := resp.(*grpc.ListProcessesResponse)
if !ok {
return nil, fmt.Errorf("Bad list processes response")
}

return processList.ProcessList, nil
}

func (k *kataAgent) onlineCPUMem(cpus uint32) error {
Expand Down Expand Up @@ -949,6 +965,8 @@ func (k *kataAgent) sendReq(request interface{}) (interface{}, error) {
return ifc, err
case *grpc.OnlineCPUMemRequest:
return k.client.OnlineCPUMem(context.Background(), req)
case *grpc.ListProcessesRequest:
return k.client.ListProcesses(context.Background(), req)
default:
return nil, fmt.Errorf("Unknown gRPC type %T", req)
}
Expand Down

0 comments on commit 4fc9740

Please sign in to comment.