linux_container: ct.Destroy() returns error if CT isn't stopped
Signed-off-by: Andrew Vagin <avagin@openvz.org>
This commit is contained in:
parent
159db89c1f
commit
bce773a8c4
3
error.go
3
error.go
|
@ -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")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue