mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
linux_container: ct.Destroy() returns error if CT isn't stopped
Signed-off-by: Andrew Vagin <avagin@openvz.org>
This commit is contained in:
committed by
Andrew Vagin
parent
159db89c1f
commit
bce773a8c4
@@ -14,6 +14,7 @@ const (
|
||||
// Container errors
|
||||
ContainerNotExists
|
||||
ContainerPaused
|
||||
ContainerNotStopped
|
||||
|
||||
// Common errors
|
||||
ConfigInvalid
|
||||
@@ -34,6 +35,8 @@ func (c ErrorCode) String() string {
|
||||
return "System error"
|
||||
case ContainerNotExists:
|
||||
return "Container does not exist"
|
||||
case ContainerNotStopped:
|
||||
return "Container isn't stopped"
|
||||
default:
|
||||
return "Unknown error"
|
||||
}
|
||||
|
||||
@@ -58,6 +58,15 @@ func (c *linuxContainer) StartProcess(config *ProcessConfig) (int, error) {
|
||||
}
|
||||
|
||||
func (c *linuxContainer) Destroy() error {
|
||||
state, err := c.RunState()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if state != Destroyed {
|
||||
return newGenericError(nil, ContainerNotStopped)
|
||||
}
|
||||
|
||||
glog.Info("destroy container")
|
||||
panic("not implemented")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user