aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2018-09-28 11:09:08 -0700
committerGitHub <noreply@github.com>2018-09-28 11:09:08 -0700
commit77d80228481d1902be0a9ed30622189b54d2e3b0 (patch)
tree3b55f94a0f2d1deb82431abfc59476b07a91dafb
parentca8469aace64d71fdb1849607d8227c31a3cf4da (diff)
parent6db7027e975029bc8c50fef958452d502620edea (diff)
downloadpodman-77d80228481d1902be0a9ed30622189b54d2e3b0.tar.gz
podman-77d80228481d1902be0a9ed30622189b54d2e3b0.tar.bz2
podman-77d80228481d1902be0a9ed30622189b54d2e3b0.zip
Merge pull request #1561 from baude/addbuildahdisttoinfo
Add buildah version and distribution to info
-rwxr-xr-xAPI.md13
-rw-r--r--cmd/podman/varlink/io.podman.varlink8
-rw-r--r--docs/podman-info.1.md83
-rw-r--r--libpod/info.go35
-rw-r--r--pkg/varlinkapi/system.go25
5 files changed, 116 insertions, 48 deletions
diff --git a/API.md b/API.md
index fc5003123..32f867605 100755
--- a/API.md
+++ b/API.md
@@ -141,6 +141,8 @@ in the [API.md](https://github.com/containers/libpod/blob/master/API.md) file in
[type ImageSearch](#ImageSearch)
+[type InfoDistribution](#InfoDistribution)
+
[type InfoGraphStatus](#InfoGraphStatus)
[type InfoHost](#InfoHost)
@@ -1115,6 +1117,13 @@ is_automated [bool](https://godoc.org/builtin#bool)
name [string](https://godoc.org/builtin#string)
star_count [int](https://godoc.org/builtin#int)
+### <a name="InfoDistribution"></a>type InfoDistribution
+
+InfoDistribution describes the the host's distribution
+
+distribution [string](https://godoc.org/builtin#string)
+
+version [string](https://godoc.org/builtin#string)
### <a name="InfoGraphStatus"></a>type InfoGraphStatus
InfoGraphStatus describes the detailed status of the storage driver
@@ -1128,6 +1137,10 @@ supports_d_type [string](https://godoc.org/builtin#string)
InfoHost describes the host stats portion of PodmanInfo
+buildah_version [string](https://godoc.org/builtin#string)
+
+distribution [InfoDistribution](#InfoDistribution)
+
mem_free [int](https://godoc.org/builtin#int)
mem_total [int](https://godoc.org/builtin#int)
diff --git a/cmd/podman/varlink/io.podman.varlink b/cmd/podman/varlink/io.podman.varlink
index 3cc24249d..810f757ca 100644
--- a/cmd/podman/varlink/io.podman.varlink
+++ b/cmd/podman/varlink/io.podman.varlink
@@ -124,8 +124,16 @@ type ContainerNameSpace (
ipc: string
)
+# InfoDistribution describes the the host's distribution
+type InfoDistribution (
+ distribution: string,
+ version: string
+)
+
# InfoHost describes the host stats portion of PodmanInfo
type InfoHost (
+ buildah_version: string,
+ distribution: InfoDistribution,
mem_free: int,
mem_total: int,
swap_free: int,
diff --git a/docs/podman-info.1.md b/docs/podman-info.1.md
index 364aaf3aa..478f79467 100644
--- a/docs/podman-info.1.md
+++ b/docs/podman-info.1.md
@@ -30,111 +30,116 @@ Run podman info with plain text response:
```
$ podman info
host:
+ BuildahVersion: 1.4-dev
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
+ package: Unknown
+ path: /usr/libexec/podman/conmon
+ version: 'conmon version 1.12.0-dev, commit: d724f3d54ad2d95b6de741085d4990190ebfd7ff'
+ Distribution:
+ distribution: fedora
+ version: "28"
+ MemFree: 1271083008
+ MemTotal: 33074233344
OCIRuntime:
- package: runc-1.0.0-46.dev.gitb4e2ecb.fc28.x86_64
+ package: runc-1.0.0-51.dev.gitfdd8055.fc28.x86_64
path: /usr/bin/runc
version: 'runc version spec: 1.0.0'
- SwapFree: 0
- SwapTotal: 0
+ SwapFree: 34309664768
+ SwapTotal: 34359734272
arch: amd64
- cpus: 4
+ cpus: 8
hostname: localhost.localdomain
- kernel: 4.17.11-200.fc28.x86_64
+ kernel: 4.18.7-200.fc28.x86_64
os: linux
- uptime: 23h 16m 57.86s (Approximately 0.96 days)
+ uptime: 218h 49m 33.66s (Approximately 9.08 days)
insecure registries:
registries: []
registries:
registries:
- - docker.io
- quay.io
- registry.fedoraproject.org
+ - docker.io
- registry.access.redhat.com
store:
ContainerStore:
- number: 3
+ number: 37
GraphDriverName: overlay
GraphOptions:
- overlay.mountopt=nodev
+ - overlay.override_kernel_check=true
GraphRoot: /var/lib/containers/storage
GraphStatus:
- Backing Filesystem: xfs
+ Backing Filesystem: extfs
Native Overlay Diff: "true"
Supports d_type: "true"
ImageStore:
- number: 2
+ number: 17
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": {
+ "BuildahVersion": "1.4-dev",
"Conmon": {
- "package": "conmon-1.10.3-1.gite558bd5.fc28.x86_64",
- "path": "/usr/libexec/crio/conmon",
- "version": "conmon version 1.10.3, commit: 55022fb3be4382a61599b7024a677f9a642ae0a7"
+ "package": "Unknown",
+ "path": "/usr/libexec/podman/conmon",
+ "version": "conmon version 1.12.0-dev, commit: d724f3d54ad2d95b6de741085d4990190ebfd7ff"
},
- "MemFree": 2484420608,
- "MemTotal": 16679260160,
+ "Distribution": {
+ "distribution": "fedora",
+ "version": "28"
+ },
+ "MemFree": 1204109312,
+ "MemTotal": 33074233344,
"OCIRuntime": {
- "package": "runc-1.0.0-46.dev.gitb4e2ecb.fc28.x86_64",
+ "package": "runc-1.0.0-51.dev.gitfdd8055.fc28.x86_64",
"path": "/usr/bin/runc",
"version": "runc version spec: 1.0.0"
},
- "SwapFree": 0,
- "SwapTotal": 0,
+ "SwapFree": 34309664768,
+ "SwapTotal": 34359734272,
"arch": "amd64",
- "cpus": 4,
+ "cpus": 8,
"hostname": "localhost.localdomain",
- "kernel": "4.17.11-200.fc28.x86_64",
+ "kernel": "4.18.7-200.fc28.x86_64",
"os": "linux",
- "uptime": "23h 14m 45.48s (Approximately 0.96 days)"
+ "uptime": "218h 50m 35.02s (Approximately 9.08 days)"
},
"insecure registries": {
"registries": []
},
"registries": {
"registries": [
- "docker.io",
"quay.io",
"registry.fedoraproject.org",
+ "docker.io",
"registry.access.redhat.com"
]
},
"store": {
"ContainerStore": {
- "number": 3
+ "number": 37
},
"GraphDriverName": "overlay",
"GraphOptions": [
- "overlay.mountopt=nodev"
+ "overlay.mountopt=nodev",
+ "overlay.override_kernel_check=true"
],
"GraphRoot": "/var/lib/containers/storage",
"GraphStatus": {
- "Backing Filesystem": "xfs",
+ "Backing Filesystem": "extfs",
"Native Overlay Diff": "true",
"Supports d_type": "true"
},
"ImageStore": {
- "number": 2
+ "number": 17
},
"RunRoot": "/var/run/containers/storage"
}
}
- ```
+```
Run podman info and only get the registries information.
```
$ podman info --format={{".registries"}}
diff --git a/libpod/info.go b/libpod/info.go
index 3add1ce0f..4cbf3f734 100644
--- a/libpod/info.go
+++ b/libpod/info.go
@@ -1,8 +1,10 @@
package libpod
import (
+ "bufio"
"bytes"
"fmt"
+ "github.com/containers/buildah"
"io/ioutil"
"os"
"runtime"
@@ -39,6 +41,7 @@ func (r *Runtime) hostInfo() (map[string]interface{}, error) {
info["SwapFree"] = mi.SwapFree
conmonVersion, _ := r.GetConmonVersion()
ociruntimeVersion, _ := r.GetOCIRuntimeVersion()
+ hostDistributionInfo := r.GetHostDistributionInfo()
info["Conmon"] = map[string]interface{}{
"path": r.conmonPath,
"package": r.ociRuntime.conmonPackage(),
@@ -49,7 +52,12 @@ func (r *Runtime) hostInfo() (map[string]interface{}, error) {
"package": r.ociRuntime.pathPackage(),
"version": ociruntimeVersion,
}
+ info["Distribution"] = map[string]interface{}{
+ "distribution": hostDistributionInfo["Distribution"],
+ "version": hostDistributionInfo["Version"],
+ }
+ info["BuildahVersion"] = buildah.Version
kv, err := readKernelVersion()
if err != nil {
return nil, errors.Wrapf(err, "error reading kernel version")
@@ -178,3 +186,30 @@ func (r *Runtime) GetOCIRuntimeVersion() (string, error) {
}
return strings.TrimSuffix(output, "\n"), nil
}
+
+// GetHostDistributionInfo returns a map containing the host's distribution and version
+func (r *Runtime) GetHostDistributionInfo() map[string]string {
+ dist := make(map[string]string)
+
+ // Populate values in case we cannot find the values
+ // or the file
+ dist["Distribution"] = "unknown"
+ dist["Version"] = "unknown"
+
+ f, err := os.Open("/etc/os-release")
+ if err != nil {
+ return dist
+ }
+ defer f.Close()
+
+ l := bufio.NewScanner(f)
+ for l.Scan() {
+ if strings.HasPrefix(l.Text(), "ID=") {
+ dist["Distribution"] = strings.TrimPrefix(l.Text(), "ID=")
+ }
+ if strings.HasPrefix(l.Text(), "VERSION_ID=") {
+ dist["Version"] = strings.Trim(strings.TrimPrefix(l.Text(), "VERSION_ID="), "\"")
+ }
+ }
+ return dist
+}
diff --git a/pkg/varlinkapi/system.go b/pkg/varlinkapi/system.go
index 54bce3d35..287f42209 100644
--- a/pkg/varlinkapi/system.go
+++ b/pkg/varlinkapi/system.go
@@ -42,17 +42,24 @@ func (i *LibpodAPI) GetInfo(call iopodman.VarlinkCall) error {
if err != nil {
return call.ReplyErrorOccurred(err.Error())
}
+
host := info[0].Data
+ distribution := iopodman.InfoDistribution{
+ Distribution: host["Distribution"].(map[string]interface{})["distribution"].(string),
+ Version: host["Distribution"].(map[string]interface{})["version"].(string),
+ }
infoHost := iopodman.InfoHost{
- Mem_free: host["MemFree"].(int64),
- Mem_total: host["MemTotal"].(int64),
- Swap_free: host["SwapFree"].(int64),
- Arch: host["arch"].(string),
- Cpus: int64(host["cpus"].(int)),
- Hostname: host["hostname"].(string),
- Kernel: host["kernel"].(string),
- Os: host["os"].(string),
- Uptime: host["uptime"].(string),
+ Buildah_version: host["BuildahVersion"].(string),
+ Distribution: distribution,
+ Mem_free: host["MemFree"].(int64),
+ Mem_total: host["MemTotal"].(int64),
+ Swap_free: host["SwapFree"].(int64),
+ Arch: host["arch"].(string),
+ Cpus: int64(host["cpus"].(int)),
+ Hostname: host["hostname"].(string),
+ Kernel: host["kernel"].(string),
+ Os: host["os"].(string),
+ Uptime: host["uptime"].(string),
}
podmanInfo.Host = infoHost
store := info[1].Data