diff options
author | Matthew Heon <matthew.heon@gmail.com> | 2018-02-28 09:29:46 -0500 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-03-01 21:17:51 +0000 |
commit | c5dc7f81fc5a1078b0bc66bd9e7a1f23a03242c5 (patch) | |
tree | f0f80eecfc6bd3b4a03b41d43ebef52207cbe1ca /libpod | |
parent | fa5f99effa7dd2ef9fbd5287b6225590b28713d1 (diff) | |
download | podman-c5dc7f81fc5a1078b0bc66bd9e7a1f23a03242c5.tar.gz podman-c5dc7f81fc5a1078b0bc66bd9e7a1f23a03242c5.tar.bz2 podman-c5dc7f81fc5a1078b0bc66bd9e7a1f23a03242c5.zip |
Replace usage of runc with runtime
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
Closes: #412
Approved by: baude
Diffstat (limited to 'libpod')
-rw-r--r-- | libpod/container.go | 2 | ||||
-rw-r--r-- | libpod/container_api.go | 13 | ||||
-rw-r--r-- | libpod/container_internal.go | 4 | ||||
-rw-r--r-- | libpod/oci.go | 11 | ||||
-rw-r--r-- | libpod/runtime_pod.go | 4 |
5 files changed, 18 insertions, 16 deletions
diff --git a/libpod/container.go b/libpod/container.go index 8dee0ae2e..dddf3d879 100644 --- a/libpod/container.go +++ b/libpod/container.go @@ -466,7 +466,7 @@ func (c *Container) CgroupParent() string { // LogPath returns the path to the container's log file // This file will only be present after Init() is called to create the container -// in runc +// in the runtime func (c *Container) LogPath() string { return c.config.LogPath } diff --git a/libpod/container_api.go b/libpod/container_api.go index 4203e8d44..2c5ed9dbe 100644 --- a/libpod/container_api.go +++ b/libpod/container_api.go @@ -117,7 +117,7 @@ func (c *Container) Init() (err error) { return err } - logrus.Debugf("Created container %s in runc", c.ID()) + logrus.Debugf("Created container %s in OCI runtime", c.ID()) c.state.State = ContainerStateCreated @@ -275,10 +275,11 @@ func (c *Container) Exec(tty, privileged bool, env, cmd []string, user string) e pidFile := c.execPidPath(sessionID) const pidWaitTimeout = 250 - // Wait until runc makes the pidfile - // TODO: If runc errors before the PID file is created, we have to wait for timeout here + // Wait until the runtime makes the pidfile + // TODO: If runtime errors before the PID file is created, we have to + // wait for timeout here if err := WaitForFile(pidFile, pidWaitTimeout*time.Millisecond); err != nil { - logrus.Debugf("Timed out waiting for pidfile from runc for container %s exec", c.ID()) + logrus.Debugf("Timed out waiting for pidfile from runtime for container %s exec", c.ID()) // Check if an error occurred in the process before we made a pidfile // TODO: Wait() here is a poor choice - is there a way to see if @@ -287,7 +288,7 @@ func (c *Container) Exec(tty, privileged bool, env, cmd []string, user string) e return err } - return errors.Wrapf(err, "timed out waiting for runc to create pidfile for exec session in container %s", c.ID()) + return errors.Wrapf(err, "timed out waiting for runtime to create pidfile for exec session in container %s", c.ID()) } // Pidfile exists, read it @@ -693,7 +694,7 @@ func (c *Container) Sync() error { return nil } - // If runc knows about the container, update its status in runc + // If runtime knows about the container, update its status in runtime // And then save back to disk if (c.state.State != ContainerStateUnknown) && (c.state.State != ContainerStateConfigured) { diff --git a/libpod/container_internal.go b/libpod/container_internal.go index 3223961fa..59de06c97 100644 --- a/libpod/container_internal.go +++ b/libpod/container_internal.go @@ -105,7 +105,7 @@ func (c *Container) execPidPath(sessionID string) string { return filepath.Join(c.state.RunDir, "exec_pid_"+sessionID) } -// Sync this container with on-disk state and runc status +// Sync this container with on-disk state and runtime status // Should only be called with container lock held // This function should suffice to ensure a container's state is accurate and // it is valid for use. @@ -113,7 +113,7 @@ func (c *Container) syncContainer() error { if err := c.runtime.state.UpdateContainer(c); err != nil { return err } - // If runc knows about the container, update its status in runc + // If runtime knows about the container, update its status in runtime // And then save back to disk if (c.state.State != ContainerStateUnknown) && (c.state.State != ContainerStateConfigured) { diff --git a/libpod/oci.go b/libpod/oci.go index ef32079f9..4f49a81e4 100644 --- a/libpod/oci.go +++ b/libpod/oci.go @@ -36,7 +36,8 @@ const ( // ContainerCreateTimeout represents the value of container creating timeout ContainerCreateTimeout = 240 * time.Second - // Timeout before declaring that runc has failed to kill a given container + // Timeout before declaring that runtime has failed to kill a given + // container killContainerTimeout = 5 * time.Second // DefaultShmSize is the default shm size DefaultShmSize = 64 * 1024 * 1024 @@ -299,7 +300,7 @@ func (r *OCIRuntime) createContainer(ctr *Container, cgroupParent string) (err e defer func() { if err != nil { if err2 := r.deleteContainer(ctr); err2 != nil { - logrus.Errorf("Error removing container %s from runc after creation failed", ctr.ID()) + logrus.Errorf("Error removing container %s from runtime after creation failed", ctr.ID()) } } }() @@ -366,7 +367,7 @@ func (r *OCIRuntime) updateContainerStatus(ctr *Container) error { case "stopped": ctr.state.State = ContainerStateStopped default: - return errors.Wrapf(ErrInternal, "unrecognized status returned by runc for container %s: %s", + return errors.Wrapf(ErrInternal, "unrecognized status returned by runtime for container %s: %s", ctr.ID(), state.Status) } @@ -477,7 +478,7 @@ func (r *OCIRuntime) stopContainer(ctr *Container, timeout uint) error { return errors.Wrapf(err, "error sending SIGKILL to container %s", ctr.ID()) } - // Give runc a few seconds to make it happen + // Give runtime a few seconds to make it happen if err := waitContainerStop(ctr, killContainerTimeout); err != nil { return err } @@ -485,7 +486,7 @@ func (r *OCIRuntime) stopContainer(ctr *Container, timeout uint) error { return nil } -// deleteContainer deletes a container from runc +// deleteContainer deletes a container from the OCI runtime func (r *OCIRuntime) deleteContainer(ctr *Container) error { _, err := utils.ExecCmd(r.path, "delete", "--force", ctr.ID()) return err diff --git a/libpod/runtime_pod.go b/libpod/runtime_pod.go index 0debb7924..3619a7a82 100644 --- a/libpod/runtime_pod.go +++ b/libpod/runtime_pod.go @@ -162,11 +162,11 @@ func (r *Runtime) RemovePod(p *Pod, removeCtrs, force bool) error { return err } - // Delete the container from runc (only if we are not + // Delete the container from runtime (only if we are not // ContainerStateConfigured) if ctr.state.State != ContainerStateConfigured { if err := r.ociRuntime.deleteContainer(ctr); err != nil { - return errors.Wrapf(err, "error removing container %s from runc", ctr.ID()) + return errors.Wrapf(err, "error removing container %s from runtime", ctr.ID()) } } |