Merge pull request #14512 from Microsoft/10662-fixdockerinfo

Windows: Fix docker info not to SIGSEGV
This commit is contained in:
Jessie Frazelle 2015-07-09 17:16:49 -07:00
commit 4893ecc112
1 changed files with 12 additions and 5 deletions

View File

@ -62,16 +62,11 @@ func (daemon *Daemon) SystemInfo() (*types.Info, error) {
Images: imgcount,
Driver: daemon.GraphDriver().String(),
DriverStatus: daemon.GraphDriver().Status(),
MemoryLimit: daemon.SystemConfig().MemoryLimit,
SwapLimit: daemon.SystemConfig().SwapLimit,
CpuCfsPeriod: daemon.SystemConfig().CpuCfsPeriod,
CpuCfsQuota: daemon.SystemConfig().CpuCfsQuota,
IPv4Forwarding: !daemon.SystemConfig().IPv4ForwardingDisabled,
BridgeNfIptables: !daemon.SystemConfig().BridgeNfCallIptablesDisabled,
BridgeNfIp6tables: !daemon.SystemConfig().BridgeNfCallIp6tablesDisabled,
Debug: os.Getenv("DEBUG") != "",
NFd: fileutils.GetTotalUsedFds(),
OomKillDisable: daemon.SystemConfig().OomKillDisable,
NGoroutines: runtime.NumGoroutine(),
SystemTime: time.Now().Format(time.RFC3339Nano),
ExecutionDriver: daemon.ExecutionDriver().Name(),
@ -90,6 +85,18 @@ func (daemon *Daemon) SystemInfo() (*types.Info, error) {
ExperimentalBuild: utils.ExperimentalBuild(),
}
// TODO Windows. Refactor this more once sysinfo is refactored into
// platform specific code. On Windows, sysinfo.cgroupMemInfo and
// sysinfo.cgroupCpuInfo will be nil otherwise and cause a SIGSEGV if
// an attempt is made to access through them.
if runtime.GOOS != "windows" {
v.MemoryLimit = daemon.SystemConfig().MemoryLimit
v.SwapLimit = daemon.SystemConfig().SwapLimit
v.OomKillDisable = daemon.SystemConfig().OomKillDisable
v.CpuCfsPeriod = daemon.SystemConfig().CpuCfsPeriod
v.CpuCfsQuota = daemon.SystemConfig().CpuCfsQuota
}
if httpProxy := os.Getenv("http_proxy"); httpProxy != "" {
v.HttpProxy = httpProxy
}