mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-28 16:27:50 +00:00
api: add sandbox Delete API
By exporting the existing sandbox delete() function. Signed-off-by: Peng Tao <bergwolf@gmail.com>
This commit is contained in:
parent
5165de0d76
commit
ef89131b85
@ -85,7 +85,7 @@ func DeleteSandbox(sandboxID string) (VCSandbox, error) {
|
||||
}
|
||||
|
||||
// Delete it.
|
||||
if err := p.delete(); err != nil {
|
||||
if err := p.Delete(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
@ -49,6 +49,7 @@ type VCSandbox interface {
|
||||
Pause() error
|
||||
Resume() error
|
||||
Release() error
|
||||
Delete() error
|
||||
}
|
||||
|
||||
// VCContainer is the Container interface
|
||||
|
@ -64,3 +64,8 @@ func (p *Sandbox) Pause() error {
|
||||
func (p *Sandbox) Resume() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Delete implements the VCSandbox function of the same name.
|
||||
func (p *Sandbox) Delete() error {
|
||||
return nil
|
||||
}
|
||||
|
@ -765,9 +765,9 @@ func (s *Sandbox) removeContainer(containerID string) error {
|
||||
containerID, s.id)
|
||||
}
|
||||
|
||||
// delete deletes an already created sandbox.
|
||||
// Delete deletes an already created sandbox.
|
||||
// The VM in which the sandbox is running will be shut down.
|
||||
func (s *Sandbox) delete() error {
|
||||
func (s *Sandbox) Delete() error {
|
||||
if s.state.State != StateReady &&
|
||||
s.state.State != StatePaused &&
|
||||
s.state.State != StateStopped {
|
||||
|
@ -605,7 +605,7 @@ func TestSandboxSetSandboxAndContainerState(t *testing.T) {
|
||||
}
|
||||
|
||||
// clean up
|
||||
err = p.delete()
|
||||
err = p.Delete()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user