summaryrefslogtreecommitdiff
path: root/libpod/oci_linux.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-07-18 09:23:47 +0200
committerGitHub <noreply@github.com>2019-07-18 09:23:47 +0200
commit7488ed6d9a619d86333dc1880d4df034fbb371b9 (patch)
tree369e340cfc6ae08b62555a9fe1e4db4d0deae5eb /libpod/oci_linux.go
parentb2734baee5637ec4440a40cca8ff5ebab377739f (diff)
parentc91bc31570f1fab616e10d0e2b4a6c8b7fe631c7 (diff)
downloadpodman-7488ed6d9a619d86333dc1880d4df034fbb371b9.tar.gz
podman-7488ed6d9a619d86333dc1880d4df034fbb371b9.tar.bz2
podman-7488ed6d9a619d86333dc1880d4df034fbb371b9.zip
Merge pull request #3522 from mheon/nix_the_artifact
Move the HostConfig portion of Inspect inside libpod
Diffstat (limited to 'libpod/oci_linux.go')
-rw-r--r--libpod/oci_linux.go18
1 files changed, 16 insertions, 2 deletions
diff --git a/libpod/oci_linux.go b/libpod/oci_linux.go
index 044373ec5..1182457f4 100644
--- a/libpod/oci_linux.go
+++ b/libpod/oci_linux.go
@@ -11,6 +11,7 @@ import (
"os/exec"
"path/filepath"
"runtime"
+ "strconv"
"strings"
"syscall"
"time"
@@ -461,8 +462,21 @@ func (r *OCIRuntime) createOCIContainer(ctr *Container, cgroupParent string, res
return errors.Wrapf(define.ErrInternal, "container create failed")
}
ctr.state.PID = ss.si.Pid
- if cmd.Process != nil {
- ctr.state.ConmonPID = cmd.Process.Pid
+ // Let's try reading the Conmon pid at the same time.
+ if ctr.config.ConmonPidFile != "" {
+ contents, err := ioutil.ReadFile(ctr.config.ConmonPidFile)
+ if err != nil {
+ logrus.Warnf("Error reading Conmon pidfile for container %s: %v", ctr.ID(), err)
+ } else {
+ // Convert it to an int
+ conmonPID, err := strconv.Atoi(string(contents))
+ if err != nil {
+ logrus.Warnf("Error decoding Conmon PID %q for container %s: %v", string(contents), ctr.ID(), err)
+ } else {
+ ctr.state.ConmonPID = conmonPID
+ logrus.Infof("Got Conmon PID as %d", conmonPID)
+ }
+ }
}
case <-time.After(ContainerCreateTimeout):
return errors.Wrapf(define.ErrInternal, "container creation timeout")