mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
add LXC version to docker info in debug mode
This commit is contained in:
parent
6e2e4cad73
commit
921c6994b1
3 changed files with 15 additions and 4 deletions
|
@ -20,10 +20,11 @@ type APIInfo struct {
|
||||||
Debug bool
|
Debug bool
|
||||||
Containers int
|
Containers int
|
||||||
Images int
|
Images int
|
||||||
NFd int `json:",omitempty"`
|
NFd int `json:",omitempty"`
|
||||||
NGoroutines int `json:",omitempty"`
|
NGoroutines int `json:",omitempty"`
|
||||||
MemoryLimit bool `json:",omitempty"`
|
MemoryLimit bool `json:",omitempty"`
|
||||||
SwapLimit bool `json:",omitempty"`
|
SwapLimit bool `json:",omitempty"`
|
||||||
|
LXCVersion string `json:",omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type APITop struct {
|
type APITop struct {
|
||||||
|
|
|
@ -463,6 +463,7 @@ func (cli *DockerCli) CmdInfo(args ...string) error {
|
||||||
fmt.Fprintf(cli.out, "Debug mode (client): %v\n", os.Getenv("DEBUG") != "")
|
fmt.Fprintf(cli.out, "Debug mode (client): %v\n", os.Getenv("DEBUG") != "")
|
||||||
fmt.Fprintf(cli.out, "Fds: %d\n", out.NFd)
|
fmt.Fprintf(cli.out, "Fds: %d\n", out.NFd)
|
||||||
fmt.Fprintf(cli.out, "Goroutines: %d\n", out.NGoroutines)
|
fmt.Fprintf(cli.out, "Goroutines: %d\n", out.NGoroutines)
|
||||||
|
fmt.Fprintf(cli.out, "LXC Version: %s\n", out.LXCVersion)
|
||||||
}
|
}
|
||||||
if !out.MemoryLimit {
|
if !out.MemoryLimit {
|
||||||
fmt.Fprintf(cli.err, "WARNING: No memory limit support\n")
|
fmt.Fprintf(cli.err, "WARNING: No memory limit support\n")
|
||||||
|
|
|
@ -208,6 +208,14 @@ func (srv *Server) DockerInfo() *APIInfo {
|
||||||
} else {
|
} else {
|
||||||
imgcount = len(images)
|
imgcount = len(images)
|
||||||
}
|
}
|
||||||
|
lxcVersion := ""
|
||||||
|
if output, err := exec.Command("lxc-version").CombinedOutput(); err == nil {
|
||||||
|
outputStr := string(output)
|
||||||
|
if len(strings.SplitN(outputStr, ":", 2)) == 2 {
|
||||||
|
lxcVersion = strings.TrimSpace(strings.SplitN(string(output), ":", 2)[1])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return &APIInfo{
|
return &APIInfo{
|
||||||
Containers: len(srv.runtime.List()),
|
Containers: len(srv.runtime.List()),
|
||||||
Images: imgcount,
|
Images: imgcount,
|
||||||
|
@ -216,6 +224,7 @@ func (srv *Server) DockerInfo() *APIInfo {
|
||||||
Debug: os.Getenv("DEBUG") != "",
|
Debug: os.Getenv("DEBUG") != "",
|
||||||
NFd: utils.GetTotalUsedFds(),
|
NFd: utils.GetTotalUsedFds(),
|
||||||
NGoroutines: runtime.NumGoroutine(),
|
NGoroutines: runtime.NumGoroutine(),
|
||||||
|
LXCVersion: lxcVersion,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue