mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-04 02:56:18 +00:00
sandbox: Create and export ProcessListContainer() to the API level
In order to support use cases such as containerd-shim-v2 where we would have a long running process holding the sandbox pointer, there would be no reason to call into the stateless function ProcessListContainer(), which would recreate a new sandbox pointer and the corresponding ones for containers. Fixes #903 Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
parent
3add296f78
commit
b298ec4228
@ -702,13 +702,7 @@ func ProcessListContainer(ctx context.Context, sandboxID, containerID string, op
|
||||
}
|
||||
defer s.releaseStatelessSandbox()
|
||||
|
||||
// Fetch the container.
|
||||
c, err := s.findContainer(containerID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return c.processList(options)
|
||||
return s.ProcessListContainer(containerID, options)
|
||||
}
|
||||
|
||||
// UpdateContainer is the virtcontainers entry point to update
|
||||
|
@ -83,6 +83,7 @@ type VCSandbox interface {
|
||||
StatsContainer(containerID string) (ContainerStats, error)
|
||||
EnterContainer(containerID string, cmd Cmd) (VCContainer, *Process, error)
|
||||
UpdateContainer(containerID string, resources specs.LinuxResources) error
|
||||
ProcessListContainer(containerID string, options ProcessListOptions) (ProcessList, error)
|
||||
WaitProcess(containerID, processID string) (int32, error)
|
||||
SignalProcess(containerID, processID string, signal syscall.Signal, all bool) error
|
||||
WinsizeProcess(containerID, processID string, height, width uint32) error
|
||||
|
@ -147,6 +147,11 @@ func (s *Sandbox) UpdateContainer(containerID string, resources specs.LinuxResou
|
||||
return nil
|
||||
}
|
||||
|
||||
// ProcessListContainer implements the VCSandbox function of the same name.
|
||||
func (s *Sandbox) ProcessListContainer(containerID string, options vc.ProcessListOptions) (vc.ProcessList, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// WaitProcess implements the VCSandbox function of the same name.
|
||||
func (s *Sandbox) WaitProcess(containerID, processID string) (int32, error) {
|
||||
return 0, nil
|
||||
|
@ -1383,6 +1383,19 @@ func (s *Sandbox) DeleteContainer(containerID string) (VCContainer, error) {
|
||||
return c, nil
|
||||
}
|
||||
|
||||
// ProcessListContainer lists every process running inside a specific
|
||||
// container in the sandbox.
|
||||
func (s *Sandbox) ProcessListContainer(containerID string, options ProcessListOptions) (ProcessList, error) {
|
||||
// Fetch the container.
|
||||
c, err := s.findContainer(containerID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Get the process list related to the container.
|
||||
return c.processList(options)
|
||||
}
|
||||
|
||||
// StatusContainer gets the status of a container
|
||||
// TODO: update container status properly, see kata-containers/runtime#253
|
||||
func (s *Sandbox) StatusContainer(containerID string) (ContainerStatus, error) {
|
||||
|
Loading…
Reference in New Issue
Block a user