diff options
author | umohnani8 <umohnani@redhat.com> | 2017-11-22 15:36:00 -0500 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2017-11-24 15:53:17 +0000 |
commit | b1a3b030688e28e6d7473d998cabbf923a8064f9 (patch) | |
tree | 7f6bdd607a3472def8601f36cbde64e52aa3065b /libkpod | |
parent | 195d48d86d871f531d72e0669ea96d315845da35 (diff) | |
download | podman-b1a3b030688e28e6d7473d998cabbf923a8064f9.tar.gz podman-b1a3b030688e28e6d7473d998cabbf923a8064f9.tar.bz2 podman-b1a3b030688e28e6d7473d998cabbf923a8064f9.zip |
Update kpod pause and unpause to use new container state
Signed-off-by: umohnani8 <umohnani@redhat.com>
Closes: #66
Approved by: mheon
Diffstat (limited to 'libkpod')
-rw-r--r-- | libkpod/pause.go | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/libkpod/pause.go b/libkpod/pause.go deleted file mode 100644 index e2e844b58..000000000 --- a/libkpod/pause.go +++ /dev/null @@ -1,46 +0,0 @@ -package libkpod - -import ( - "github.com/pkg/errors" - "github.com/projectatomic/libpod/oci" -) - -// ContainerPause pauses a running container. -func (c *ContainerServer) ContainerPause(container string) (string, error) { - ctr, err := c.LookupContainer(container) - if err != nil { - return "", errors.Wrapf(err, "failed to find container %s", container) - } - - cStatus := c.runtime.ContainerStatus(ctr) - if cStatus.Status != oci.ContainerStatePaused { - if err := c.runtime.PauseContainer(ctr); err != nil { - return "", errors.Wrapf(err, "failed to pause container %s", ctr.ID()) - } - c.ContainerStateToDisk(ctr) - } else { - return "", errors.Wrapf(err, "container %s is already paused", ctr.ID()) - } - - return ctr.ID(), nil -} - -// ContainerUnpause unpauses a running container with a grace period (i.e., timeout). -func (c *ContainerServer) ContainerUnpause(container string) (string, error) { - ctr, err := c.LookupContainer(container) - if err != nil { - return "", errors.Wrapf(err, "failed to find container %s", container) - } - - cStatus := c.runtime.ContainerStatus(ctr) - if cStatus.Status == oci.ContainerStatePaused { - if err := c.runtime.UnpauseContainer(ctr); err != nil { - return "", errors.Wrapf(err, "failed to unpause container %s", ctr.ID()) - } - c.ContainerStateToDisk(ctr) - } else { - return "", errors.Wrapf(err, "the container %s is not paused", ctr.ID()) - } - - return ctr.ID(), nil -} |