summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2018-08-02 16:21:36 -0500
committerAtomic Bot <atomic-devel@projectatomic.io>2018-08-05 23:19:47 +0000
commit99a37afc3ae0616fa99b39ecdb5a436f2150480f (patch)
tree0e94863954776633fc80a2d7c9bcf1f0b82d7c53
parent5acbbf03e3675bc3a61b66493f4b86c07da3f167 (diff)
downloadpodman-99a37afc3ae0616fa99b39ecdb5a436f2150480f.tar.gz
podman-99a37afc3ae0616fa99b39ecdb5a436f2150480f.tar.bz2
podman-99a37afc3ae0616fa99b39ecdb5a436f2150480f.zip
Add Runc and Conmon versions to Podman Version
It will be handy to know the runc and conmon versions as our code gets into the wild. Signed-off-by: baude <bbaude@redhat.com> Closes: #1207 Approved by: rhatdan
-rw-r--r--docs/podman-info.1.md59
-rw-r--r--libpod/info.go25
2 files changed, 68 insertions, 16 deletions
diff --git a/docs/podman-info.1.md b/docs/podman-info.1.md
index ccd7ff315..ebcedace4 100644
--- a/docs/podman-info.1.md
+++ b/docs/podman-info.1.md
@@ -26,19 +26,22 @@ Change output format to "json" or a Go template.
## EXAMPLE
+Run podman info with plain text response:
```
$ podman info
host:
- MemFree: 7822168064
- MemTotal: 33080606720
- SwapFree: 34357637120
+ MemFree: 28464242688
+ MemTotal: 33147686912
+ OCIRuntimeVersion: 'runc version spec: 1.0.0'
+ SwapFree: 34359734272
SwapTotal: 34359734272
arch: amd64
+ conmonVersion: 'conmon version 1.11.0-dev, commit: 42209340c7abcab66f47e9161fa0f1b16ea8c134'
cpus: 8
hostname: localhost.localdomain
- kernel: 4.13.16-300.fc27.x86_64
+ kernel: 4.17.9-200.fc28.x86_64
os: linux
- uptime: 142h 13m 55.64s (Approximately 5.92 days)
+ uptime: 47m 34.95s
insecure registries:
registries: []
registries:
@@ -48,7 +51,7 @@ registries:
- registry.access.redhat.com
store:
ContainerStore:
- number: 7
+ number: 40
GraphDriverName: overlay
GraphOptions:
- overlay.override_kernel_check=true
@@ -61,32 +64,56 @@ store:
number: 10
RunRoot: /var/run/containers/storage
```
+Run podman info with JSON formatted response:
```
$ podman info --debug --format json
{
"host": {
- "MemFree": 7506157568,
- "MemTotal": 33080606720,
- "SwapFree": 34357637120,
+ "MemFree": 28421324800,
+ "MemTotal": 33147686912,
+ "OCIRuntimeVersion": "runc version spec: 1.0.0",
+ "SwapFree": 34359734272,
"SwapTotal": 34359734272,
"arch": "amd64",
+ "conmonVersion": "conmon version 1.11.0-dev, commit: 42209340c7abcab66f47e9161fa0f1b16ea8c134",
"cpus": 8,
"hostname": "localhost.localdomain",
- "kernel": "4.13.16-300.fc27.x86_64",
+ "kernel": "4.17.9-200.fc28.x86_64",
"os": "linux",
- "uptime": "142h 17m 17.04s (Approximately 5.92 days)"
-
- ... removed for brevity
-
+ "uptime": "50m 20.27s"
+ },
+ "insecure registries": {
+ "registries": []
+ },
+ "registries": {
+ "registries": [
+ "docker.io",
+ "registry.fedoraproject.org",
+ "registry.access.redhat.com",
+ ]
+ },
+ "store": {
+ "ContainerStore": {
+ "number": 40
+ },
+ "GraphDriverName": "overlay",
+ "GraphOptions": [
+ "overlay.override_kernel_check=true"
+ ],
+ "GraphRoot": "/var/lib/containers/storage",
+ "GraphStatus": {
+ "Backing Filesystem": "extfs",
+ "Native Overlay Diff": "true",
+ "Supports d_type": "true"
+ },
"ImageStore": {
"number": 10
},
"RunRoot": "/var/run/containers/storage"
}
}
-
```
-
+Run podman info and only get the registries information.
```
$ podman info --format={{".registries"}}
map[registries:[docker.io registry.fedoraproject.org registry.access.redhat.com]]
diff --git a/libpod/info.go b/libpod/info.go
index cc9d55553..fe422747c 100644
--- a/libpod/info.go
+++ b/libpod/info.go
@@ -7,10 +7,12 @@ import (
"os"
"runtime"
"strconv"
+ "strings"
"time"
"github.com/docker/docker/pkg/system"
"github.com/pkg/errors"
+ "github.com/projectatomic/libpod/utils"
)
// InfoData holds the info type, i.e store, host etc and the data for each type
@@ -84,6 +86,11 @@ 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
}
@@ -146,3 +153,21 @@ func readUptime() (string, error) {
}
return string(f[0]), nil
}
+
+// GetConmonVersion returns a string representation of the conmon version
+func (r *Runtime) GetConmonVersion() (string, error) {
+ output, err := utils.ExecCmd(r.conmonPath, "--version")
+ if err != nil {
+ return "", err
+ }
+ return strings.TrimSuffix(strings.Replace(output, "\n", ", ", 1), "\n"), nil
+}
+
+// GetOCIRuntimeVersion returns a string representation of the oci runtimes version
+func (r *Runtime) GetOCIRuntimeVersion() (string, error) {
+ output, err := utils.ExecCmd(r.ociRuntimePath, "--version")
+ if err != nil {
+ return "", err
+ }
+ return strings.TrimSuffix(output, "\n"), nil
+}