mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-03 18:47:03 +00:00
sandbox: Export Stop() 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 StopSandbox(), 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
6c3e266eb9
commit
109e12aa56
@ -264,16 +264,11 @@ func StopSandbox(ctx context.Context, sandboxID string) (VCSandbox, error) {
|
||||
defer s.releaseStatelessSandbox()
|
||||
|
||||
// Stop it.
|
||||
err = s.stop()
|
||||
err = s.Stop()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Remove the network.
|
||||
if err := s.removeNetwork(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return s, nil
|
||||
}
|
||||
|
||||
|
@ -67,6 +67,7 @@ type VCSandbox interface {
|
||||
SetAnnotations(annotations map[string]string) error
|
||||
|
||||
Start() error
|
||||
Stop() error
|
||||
Pause() error
|
||||
Resume() error
|
||||
Release() error
|
||||
|
@ -72,6 +72,11 @@ func (s *Sandbox) Start() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Stop implements the VCSandbox function of the same name.
|
||||
func (s *Sandbox) Stop() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Pause implements the VCSandbox function of the same name.
|
||||
func (s *Sandbox) Pause() error {
|
||||
return nil
|
||||
|
@ -1464,9 +1464,9 @@ func (s *Sandbox) Start() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// stop stops a sandbox. The containers that are making the sandbox
|
||||
// Stop stops a sandbox. The containers that are making the sandbox
|
||||
// will be destroyed.
|
||||
func (s *Sandbox) stop() error {
|
||||
func (s *Sandbox) Stop() error {
|
||||
span, _ := s.trace("stop")
|
||||
defer span.Finish()
|
||||
|
||||
@ -1489,7 +1489,12 @@ func (s *Sandbox) stop() error {
|
||||
return err
|
||||
}
|
||||
|
||||
return s.setSandboxState(StateStopped)
|
||||
if err := s.setSandboxState(StateStopped); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Remove the network.
|
||||
return s.removeNetwork()
|
||||
}
|
||||
|
||||
// Pause pauses the sandbox
|
||||
|
Loading…
Reference in New Issue
Block a user