add more commands in container manager menu

Signed-off-by: xiechengsheng <XIE1995@whut.edu.cn>
This commit is contained in:
xiechengsheng
2018-06-22 15:41:16 +08:00
parent a3b8585697
commit f7a3d38d6b
6 changed files with 91 additions and 0 deletions

View File

@@ -117,3 +117,35 @@ func (c *Container) Remove() {
log.StatusErr(err)
}
}
func (c *Container) Pause() {
if c.Meta["state"] == "running" {
if err := c.manager.Pause(); err != nil {
log.Warningf("container %s: %v", c.Id, err)
log.StatusErr(err)
return
}
c.SetState("paused")
}
}
func (c *Container) Unpause() {
if c.Meta["state"] == "paused" {
if err := c.manager.Unpause(); err != nil {
log.Warningf("container %s: %v", c.Id, err)
log.StatusErr(err)
return
}
c.SetState("running")
}
}
func (c *Container) Restart() {
if c.Meta["state"] == "running" {
if err := c.manager.Restart(); err != nil {
log.Warningf("container %s: %v", c.Id, err)
log.StatusErr(err)
return
}
}
}