2014-07-30 05:13:53 -04:00
|
|
|
package daemon
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/docker/docker/engine"
|
|
|
|
)
|
|
|
|
|
|
|
|
func (daemon *Daemon) ContainerPause(job *engine.Job) engine.Status {
|
|
|
|
if len(job.Args) != 1 {
|
|
|
|
return job.Errorf("Usage: %s CONTAINER", job.Name)
|
|
|
|
}
|
|
|
|
name := job.Args[0]
|
|
|
|
container := daemon.Get(name)
|
|
|
|
if container == nil {
|
|
|
|
return job.Errorf("No such container: %s", name)
|
|
|
|
}
|
|
|
|
if err := container.Pause(); err != nil {
|
|
|
|
return job.Errorf("Cannot pause container %s: %s", name, err)
|
|
|
|
}
|
2014-07-31 07:50:59 -04:00
|
|
|
container.LogEvent("pause")
|
2014-07-30 05:13:53 -04:00
|
|
|
return engine.StatusOK
|
|
|
|
}
|
2014-07-30 05:35:39 -04:00
|
|
|
|
|
|
|
func (daemon *Daemon) ContainerUnpause(job *engine.Job) engine.Status {
|
|
|
|
if n := len(job.Args); n < 1 || n > 2 {
|
|
|
|
return job.Errorf("Usage: %s CONTAINER", job.Name)
|
|
|
|
}
|
|
|
|
name := job.Args[0]
|
|
|
|
container := daemon.Get(name)
|
|
|
|
if container == nil {
|
|
|
|
return job.Errorf("No such container: %s", name)
|
|
|
|
}
|
|
|
|
if err := container.Unpause(); err != nil {
|
|
|
|
return job.Errorf("Cannot unpause container %s: %s", name, err)
|
|
|
|
}
|
2014-07-31 07:50:59 -04:00
|
|
|
container.LogEvent("unpause")
|
2014-07-30 05:35:39 -04:00
|
|
|
return engine.StatusOK
|
|
|
|
}
|