Add kpod pause and kpod unpause

Implement the ability to pause and unpause running containers.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>
This commit is contained in:
Daniel J Walsh 2017-09-19 12:26:32 +00:00 committed by TomSweeneyRedHat
parent 45747cc5d0
commit 9db7cf1370
13 changed files with 444 additions and 11 deletions

View file

@ -24,6 +24,8 @@ import (
const (
// ContainerStateCreated represents the created state of a container
ContainerStateCreated = "created"
// ContainerStatePaused represents the paused state of a container
ContainerStatePaused = "paused"
// ContainerStateRunning represents the running state of a container
ContainerStateRunning = "running"
// ContainerStateStopped represents the stopped state of a container
@ -678,3 +680,19 @@ func (r *Runtime) RuntimeReady() (bool, error) {
func (r *Runtime) NetworkReady() (bool, error) {
return true, nil
}
// PauseContainer pauses a container.
func (r *Runtime) PauseContainer(c *Container) error {
c.opLock.Lock()
defer c.opLock.Unlock()
_, err := utils.ExecCmd(r.Path(c), "pause", c.id)
return err
}
// UnpauseContainer unpauses a container.
func (r *Runtime) UnpauseContainer(c *Container) error {
c.opLock.Lock()
defer c.opLock.Unlock()
_, err := utils.ExecCmd(r.Path(c), "resume", c.id)
return err
}