Change:
<!-- This form is for bug reports and feature requests ONLY! If you're looking for help check and the . --Is this a BUG REPORT or FEATURE REQUEST?: /kind bug What happened: Windows uses GetPhysicallyInstalledSystemMemory to get physical memory installed on Windows machine and reports it as part of node metrics to heapster, etc. On VMWare Fusion, GetPhysicallyInstalledSystemMemory fails to read data from SMBIOS firmware tables and returns error code 0x0d. That causes on Windows to bail out. It is also reported on Virtualbox. What you expected to happen: Windows should be able read to physical memory on the system and shouldn't exit. How to reproduce it (as minimally and precisely as possible): Run on VMWare Fusion or Virtualbox . Anything else we need to know?: Environment: Kubernetes version (use ): latest Cloud provider or hardware configuration: OS (e.g. from /etc/os-release): Windows Kernel (e.g. ): Install tools: Others: VMWare Fusion or Virtualbox
/sig windows /sig node
this will likely get fixed after 1.9 is released
Sure, I am fixing it. Unfortunately it missed the 1.9 train.
Hi, any idea on when this might get fixed? Thanks!
It is fixed in Got test failure in pull-kubernetes-e2e-kops-aws yesterday but not before. I will look into it shortly.
thanks for the swift reply! I need to learn some new (for me) github skills to get that PR.
i just approved the PR again. we should be good to go. can you please check

Discussion:
"os" "runtime" "sync" <del> "syscall" </del> "time" "unsafe" "github.com/golang/glog" cadvisorapi "github.com/google/cadvisor/info/v1" <ins> "golang.org/x/sys/windows" </ins> "k8s.io/apimachinery/pkg/util/wait" ) <ins> // MemoryStatusEx is the same as Windows structure MEMORYSTATUSEX // https://msdn.microsoft.com/en-us/library/windows/desktop/aa366770(v=vs.85).aspx type MemoryStatusEx struct { Length               uint32 MemoryLoad           uint32 TotalPhys            uint64 AvailPhys            uint64 TotalPageFile        uint64 AvailPageFile        uint64 TotalVirtual         uint64 AvailVirtual         uint64 AvailExtendedVirtual uint64 } </ins> var ( <del> modkernel32                            = syscall.NewLazyDLL("kernel32.dll") procGetPhysicallyInstalledSystemMemory = modkernel32.NewProc("GetPhysicallyInstalledSystemMemory") </del> <ins> modkernel32              = windows.NewLazySystemDLL("kernel32.dll") procGlobalMemoryStatusEx = modkernel32.NewProc("GlobalMemoryStatusEx") </ins> ) // NewPerfCounterClient creates a client using perf counters

} func getPhysicallyInstalledSystemMemoryBytes() (uint64, error) { <del> var physicalMemoryKiloBytes uint64 if ok := getPhysicallyInstalledSystemMemory(&physicalMemoryKiloBytes); !ok { </del> <ins> // We use GlobalMemoryStatusEx instead of GetPhysicallyInstalledSystemMemory // on Windows node for the following reasons: // 1. GetPhysicallyInstalledSystemMemory retrieves the amount of physically // installed RAM from the computer's SMBIOS firmware tables. // https://msdn.microsoft.com/en-us/library/windows/desktop/cc300158(v=vs.85).aspx // On some VM, it is unable to read data from SMBIOS and fails with ERROR_INVALID_DATA. // 2. On Linux node, total physical memory is read from MemTotal in /proc/meminfo. // GlobalMemoryStatusEx returns the amount of physical memory that is available // for the operating system to use. The amount returned by GlobalMemoryStatusEx // is closer in parity with Linux // https://www.kernel.org/doc/Documentation/filesystems/proc.txt var statex MemoryStatusEx statex.Length = uint32(unsafe.Sizeof(statex)) ret, _, _ := procGlobalMemoryStatusEx.Call(uintptr(unsafe.Pointer(&statex))) if ret == 0 { </ins> return 0, errors.New("unable to read physical memory") } <del> return physicalMemoryKiloBytes * 1024, nil // convert kilobytes to bytes } func getPhysicallyInstalledSystemMemory(totalMemoryInKilobytes *uint64) bool { ret, _, _ := syscall.Syscall(procGetPhysicallyInstalledSystemMemory.Addr(), 1, uintptr(unsafe.Pointer(totalMemoryInKilobytes)), 0, 0) return ret != 0 </del> <ins> return statex.TotalPhys, nil </ins> }