summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2018-08-06 11:35:29 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2018-08-07 14:16:26 +0000
commit33d6221ae34103d68753156ff2638802817dfa16 (patch)
tree11ed782c99565d37e33a178bf2da627ea1b33a77 /libpod
parentb1de943eea26bf1f6a6c599116cba3e7d9fe5d36 (diff)
downloadpodman-33d6221ae34103d68753156ff2638802817dfa16.tar.gz
podman-33d6221ae34103d68753156ff2638802817dfa16.tar.bz2
podman-33d6221ae34103d68753156ff2638802817dfa16.zip
Have info print conmon/oci runtime information
We need into to identify the OCI runtime and conmon used by podman. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com> Closes: #1224 Approved by: baude
Diffstat (limited to 'libpod')
-rw-r--r--libpod/info.go17
-rw-r--r--libpod/oci_linux.go18
-rw-r--r--libpod/oci_unsupported.go8
3 files changed, 38 insertions, 5 deletions
diff --git a/libpod/info.go b/libpod/info.go
index fe422747c..5bb77f447 100644
--- a/libpod/info.go
+++ b/libpod/info.go
@@ -37,6 +37,18 @@ func (r *Runtime) hostInfo() (map[string]interface{}, error) {
info["MemFree"] = mi.MemFree
info["SwapTotal"] = mi.SwapTotal
info["SwapFree"] = mi.SwapFree
+ conmonVersion, _ := r.GetConmonVersion()
+ ociruntimeVersion, _ := r.GetOCIRuntimeVersion()
+ info["Conmon"] = map[string]interface{}{
+ "path": r.conmonPath,
+ "package": r.ociRuntime.conmonPackage(),
+ "version": conmonVersion,
+ }
+ info["OCIRuntime"] = map[string]interface{}{
+ "path": r.ociRuntime.path,
+ "package": r.ociRuntime.pathPackage(),
+ "version": ociruntimeVersion,
+ }
kv, err := readKernelVersion()
if err != nil {
@@ -86,11 +98,6 @@ func (r *Runtime) hostInfo() (map[string]interface{}, error) {
}
info["hostname"] = host
- // Don't think this should be catastrophic if we cannot get the versions
- conmonVersion, _ := r.GetConmonVersion()
- ociruntimeVersion, _ := r.GetOCIRuntimeVersion()
- info["conmonVersion"] = conmonVersion
- info["OCIRuntimeVersion"] = ociruntimeVersion
return info, nil
}
diff --git a/libpod/oci_linux.go b/libpod/oci_linux.go
index 2be7ee07c..e105680b7 100644
--- a/libpod/oci_linux.go
+++ b/libpod/oci_linux.go
@@ -8,6 +8,7 @@ import (
"os/exec"
"path/filepath"
"runtime"
+ "strings"
"sync"
"github.com/containerd/cgroups"
@@ -102,3 +103,20 @@ func (r *OCIRuntime) createContainer(ctr *Container, cgroupParent string) (err e
return err
}
+
+func rpmVersion(path string) string {
+ output := "Unknown"
+ cmd := exec.Command("/usr/bin/rpm", "-q", "-f", path)
+ if outp, err := cmd.Output(); err == nil {
+ output = string(outp)
+ }
+ return strings.Trim(output, "\n")
+}
+
+func (r *OCIRuntime) pathPackage() string {
+ return rpmVersion(r.path)
+}
+
+func (r *OCIRuntime) conmonPackage() string {
+ return rpmVersion(r.conmonPath)
+}
diff --git a/libpod/oci_unsupported.go b/libpod/oci_unsupported.go
index 409bb117e..8cb4994d3 100644
--- a/libpod/oci_unsupported.go
+++ b/libpod/oci_unsupported.go
@@ -18,3 +18,11 @@ func newPipe() (parent *os.File, child *os.File, err error) {
func (r *OCIRuntime) createContainer(ctr *Container, cgroupParent string) (err error) {
return ErrNotImplemented
}
+
+func (r *OCIRuntime) pathPackage() string {
+ return ""
+}
+
+func (r *OCIRuntime) conmonPackage() string {
+ return ""
+}