diff options
-rw-r--r-- | docs/podman-info.1.md | 80 | ||||
-rw-r--r-- | libpod/info.go | 17 | ||||
-rw-r--r-- | libpod/oci_linux.go | 18 | ||||
-rw-r--r-- | libpod/oci_unsupported.go | 8 |
4 files changed, 89 insertions, 34 deletions
diff --git a/docs/podman-info.1.md b/docs/podman-info.1.md index ebcedace4..85e0e28bc 100644 --- a/docs/podman-info.1.md +++ b/docs/podman-info.1.md @@ -30,57 +30,78 @@ Run podman info with plain text response: ``` $ podman info host: - MemFree: 28464242688 - MemTotal: 33147686912 - OCIRuntimeVersion: 'runc version spec: 1.0.0' - SwapFree: 34359734272 - SwapTotal: 34359734272 + Conmon: + package: conmon-1.10.3-1.gite558bd5.fc28.x86_64 + path: /usr/libexec/crio/conmon + version: 'conmon version 1.10.3, commit: 55022fb3be4382a61599b7024a677f9a642ae0a7' + MemFree: 2428579840 + MemTotal: 16679260160 + OCIRuntime: + package: runc-1.0.0-46.dev.gitb4e2ecb.fc28.x86_64 + path: /usr/bin/runc + version: 'runc version spec: 1.0.0' + SwapFree: 0 + SwapTotal: 0 arch: amd64 - conmonVersion: 'conmon version 1.11.0-dev, commit: 42209340c7abcab66f47e9161fa0f1b16ea8c134' - cpus: 8 + cpus: 4 hostname: localhost.localdomain - kernel: 4.17.9-200.fc28.x86_64 + kernel: 4.17.11-200.fc28.x86_64 os: linux - uptime: 47m 34.95s + uptime: 23h 16m 57.86s (Approximately 0.96 days) insecure registries: registries: [] registries: registries: - docker.io + - quay.io - registry.fedoraproject.org - registry.access.redhat.com store: ContainerStore: - number: 40 + number: 3 GraphDriverName: overlay GraphOptions: - - overlay.override_kernel_check=true + - overlay.mountopt=nodev GraphRoot: /var/lib/containers/storage GraphStatus: - Backing Filesystem: extfs + Backing Filesystem: xfs Native Overlay Diff: "true" Supports d_type: "true" ImageStore: - number: 10 + number: 2 RunRoot: /var/run/containers/storage ``` Run podman info with JSON formatted response: ``` $ podman info --debug --format json { + "debug": { + "compiler": "gc", + "git commit": "", + "go version": "go1.10", + "podman version": "0.8.2-dev" + }, "host": { - "MemFree": 28421324800, - "MemTotal": 33147686912, - "OCIRuntimeVersion": "runc version spec: 1.0.0", - "SwapFree": 34359734272, - "SwapTotal": 34359734272, + "Conmon": { + "package": "conmon-1.10.3-1.gite558bd5.fc28.x86_64", + "path": "/usr/libexec/crio/conmon", + "version": "conmon version 1.10.3, commit: 55022fb3be4382a61599b7024a677f9a642ae0a7" + }, + "MemFree": 2484420608, + "MemTotal": 16679260160, + "OCIRuntime": { + "package": "runc-1.0.0-46.dev.gitb4e2ecb.fc28.x86_64", + "path": "/usr/bin/runc", + "version": "runc version spec: 1.0.0" + }, + "SwapFree": 0, + "SwapTotal": 0, "arch": "amd64", - "conmonVersion": "conmon version 1.11.0-dev, commit: 42209340c7abcab66f47e9161fa0f1b16ea8c134", - "cpus": 8, + "cpus": 4, "hostname": "localhost.localdomain", - "kernel": "4.17.9-200.fc28.x86_64", + "kernel": "4.17.11-200.fc28.x86_64", "os": "linux", - "uptime": "50m 20.27s" + "uptime": "23h 14m 45.48s (Approximately 0.96 days)" }, "insecure registries": { "registries": [] @@ -88,35 +109,36 @@ $ podman info --debug --format json "registries": { "registries": [ "docker.io", + "quay.io", "registry.fedoraproject.org", - "registry.access.redhat.com", + "registry.access.redhat.com" ] }, "store": { "ContainerStore": { - "number": 40 + "number": 3 }, "GraphDriverName": "overlay", "GraphOptions": [ - "overlay.override_kernel_check=true" + "overlay.mountopt=nodev" ], "GraphRoot": "/var/lib/containers/storage", "GraphStatus": { - "Backing Filesystem": "extfs", + "Backing Filesystem": "xfs", "Native Overlay Diff": "true", "Supports d_type": "true" }, "ImageStore": { - "number": 10 + "number": 2 }, "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]] +map[registries:[docker.io quay.io registry.fedoraproject.org registry.access.redhat.com]] ``` ## SEE ALSO 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 "" +} |