mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-28 00:07:16 +00:00
api: add sandbox pause and resume API
By exporting the existing sandbox operations. Signed-off-by: Peng Tao <bergwolf@gmail.com>
This commit is contained in:
parent
eb23771d5a
commit
5165de0d76
@ -46,6 +46,8 @@ type VCSandbox interface {
|
||||
ID() string
|
||||
SetAnnotations(annotations map[string]string) error
|
||||
|
||||
Pause() error
|
||||
Resume() error
|
||||
Release() error
|
||||
}
|
||||
|
||||
|
@ -54,3 +54,13 @@ func (p *Sandbox) GetContainer(containerID string) vc.VCContainer {
|
||||
func (p *Sandbox) Release() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Pause implements the VCSandbox function of the same name.
|
||||
func (p *Sandbox) Pause() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Resume implements the VCSandbox function of the same name.
|
||||
func (p *Sandbox) Resume() error {
|
||||
return nil
|
||||
}
|
||||
|
@ -929,7 +929,8 @@ func (s *Sandbox) stop() error {
|
||||
return s.setSandboxState(StateStopped)
|
||||
}
|
||||
|
||||
func (s *Sandbox) pause() error {
|
||||
// Pause pauses the sandbox
|
||||
func (s *Sandbox) Pause() error {
|
||||
if err := s.hypervisor.pauseSandbox(); err != nil {
|
||||
return err
|
||||
}
|
||||
@ -937,7 +938,8 @@ func (s *Sandbox) pause() error {
|
||||
return s.pauseSetStates()
|
||||
}
|
||||
|
||||
func (s *Sandbox) resume() error {
|
||||
// Resume resumes the sandbox
|
||||
func (s *Sandbox) Resume() error {
|
||||
if err := s.hypervisor.resumeSandbox(); err != nil {
|
||||
return err
|
||||
}
|
||||
@ -1079,9 +1081,9 @@ func togglePauseSandbox(sandboxID string, pause bool) (*Sandbox, error) {
|
||||
}
|
||||
|
||||
if pause {
|
||||
err = p.pause()
|
||||
err = p.Pause()
|
||||
} else {
|
||||
err = p.resume()
|
||||
err = p.Resume()
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user