summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2018-05-10 13:41:23 -0500
committerAtomic Bot <atomic-devel@projectatomic.io>2018-05-11 14:00:25 +0000
commit834f1f641eaaebd6a9f014617be0d74d409cd2b1 (patch)
tree4ee23a0405fd171c7a67f91fb166a1071ba40065 /pkg
parentf97de48be47b838744aecd72c73b92a1b0be5cbd (diff)
downloadpodman-834f1f641eaaebd6a9f014617be0d74d409cd2b1.tar.gz
podman-834f1f641eaaebd6a9f014617be0d74d409cd2b1.tar.bz2
podman-834f1f641eaaebd6a9f014617be0d74d409cd2b1.zip
varlink info
The varlinfo info returns the same information as podman info but always includes the so-called debug information. Signed-off-by: baude <bbaude@redhat.com> Closes: #745 Approved by: baude
Diffstat (limited to 'pkg')
-rw-r--r--pkg/varlinkapi/system.go57
1 files changed, 57 insertions, 0 deletions
diff --git a/pkg/varlinkapi/system.go b/pkg/varlinkapi/system.go
index 418db6445..63acad909 100644
--- a/pkg/varlinkapi/system.go
+++ b/pkg/varlinkapi/system.go
@@ -1,6 +1,10 @@
package varlinkapi
import (
+ goruntime "runtime"
+ "strings"
+
+ "github.com/projectatomic/libpod/cmd/podman/libpodruntime"
"github.com/projectatomic/libpod/cmd/podman/varlink"
"github.com/projectatomic/libpod/libpod"
)
@@ -28,3 +32,56 @@ func (i *LibpodAPI) Ping(call ioprojectatomicpodman.VarlinkCall) error {
Message: "OK",
})
}
+
+// GetInfo returns details about the podman host and its stores
+func (i *LibpodAPI) GetInfo(call ioprojectatomicpodman.VarlinkCall) error {
+ podmanInfo := ioprojectatomicpodman.PodmanInfo{}
+ runtime, err := libpodruntime.GetRuntime(i.Cli)
+ if err != nil {
+ return call.ReplyRuntimeError(err.Error())
+ }
+ info, err := runtime.Info()
+ if err != nil {
+ return call.ReplyErrorOccurred(err.Error())
+ }
+ host := info[0].Data
+ infoHost := ioprojectatomicpodman.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),
+ }
+ podmanInfo.Host = infoHost
+ store := info[1].Data
+ pmaninfo := ioprojectatomicpodman.InfoPodmanBinary{
+ Compiler: goruntime.Compiler,
+ Go_version: goruntime.Version(),
+ // TODO : How are we going to get this here?
+ //Podman_version:
+ Git_commit: libpod.GitCommit,
+ }
+
+ graphStatus := ioprojectatomicpodman.InfoGraphStatus{
+ Backing_filesystem: store["GraphStatus"].(map[string]string)["Backing Filesystem"],
+ Native_overlay_diff: store["GraphStatus"].(map[string]string)["Native Overlay Diff"],
+ Supports_d_type: store["GraphStatus"].(map[string]string)["Supports d_type"],
+ }
+ infoStore := ioprojectatomicpodman.InfoStore{
+ Graph_driver_name: store["GraphDriverName"].(string),
+ Containers: int64(store["ContainerStore"].(map[string]interface{})["number"].(int)),
+ Images: int64(store["ImageStore"].(map[string]interface{})["number"].(int)),
+ Run_root: store["RunRoot"].(string),
+ Graph_root: store["GraphRoot"].(string),
+ Graph_driver_options: strings.Join(store["GraphOptions"].([]string), ", "),
+ Graph_status: graphStatus,
+ }
+
+ podmanInfo.Store = infoStore
+ podmanInfo.Podman = pmaninfo
+ return call.ReplyGetInfo(podmanInfo)
+}