linux_container: ct.Destroy() returns error if CT isn't stopped

Signed-off-by: Andrew Vagin <avagin@openvz.org>
This commit is contained in:
Andrey Vagin 2014-12-15 18:00:04 +03:00 committed by Andrew Vagin
parent 159db89c1f
commit bce773a8c4
2 changed files with 12 additions and 0 deletions

View File

@ -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"
}

View File

@ -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")
}