From 8594a6fb2cbbe8d6c1b2faffc484643d6c95a82e Mon Sep 17 00:00:00 2001 From: Maciej Iwanowski Date: Tue, 25 Feb 2020 03:41:08 +0100 Subject: [PATCH] Setting NVM power budget information on MachineInfo struct Signed-off-by: Maciej "Iwan" Iwanowski --- machine/info.go | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/machine/info.go b/machine/info.go index 23234939..fa87283a 100644 --- a/machine/info.go +++ b/machine/info.go @@ -78,6 +78,11 @@ func Info(sysFs sysfs.SysFs, fsInfo fs.FsInfo, inHostNamespace bool) (*info.Mach return nil, err } + nvmPowerBudget, err := GetNVMAvgPowerBudget() + if err != nil { + return nil, err + } + hugePagesInfo, err := GetHugePagesInfo(hugepagesDirectory) if err != nil { return nil, err @@ -114,22 +119,23 @@ func Info(sysFs sysfs.SysFs, fsInfo fs.FsInfo, inHostNamespace bool) (*info.Mach instanceID := realCloudInfo.GetInstanceID() machineInfo := &info.MachineInfo{ - NumCores: numCores, - NumPhysicalCores: GetPhysicalCores(cpuinfo), - NumSockets: GetSockets(cpuinfo), - CpuFrequency: clockSpeed, - MemoryCapacity: memoryCapacity, - MemoryByType: memoryByType, - HugePages: hugePagesInfo, - DiskMap: diskMap, - NetworkDevices: netDevices, - Topology: topology, - MachineID: getInfoFromFiles(filepath.Join(rootFs, *machineIdFilePath)), - SystemUUID: systemUUID, - BootID: getInfoFromFiles(filepath.Join(rootFs, *bootIdFilePath)), - CloudProvider: cloudProvider, - InstanceType: instanceType, - InstanceID: instanceID, + NumCores: numCores, + NumPhysicalCores: GetPhysicalCores(cpuinfo), + NumSockets: GetSockets(cpuinfo), + CpuFrequency: clockSpeed, + MemoryCapacity: memoryCapacity, + MemoryByType: memoryByType, + NVMAvgPowerBudget: nvmPowerBudget, + HugePages: hugePagesInfo, + DiskMap: diskMap, + NetworkDevices: netDevices, + Topology: topology, + MachineID: getInfoFromFiles(filepath.Join(rootFs, *machineIdFilePath)), + SystemUUID: systemUUID, + BootID: getInfoFromFiles(filepath.Join(rootFs, *bootIdFilePath)), + CloudProvider: cloudProvider, + InstanceType: instanceType, + InstanceID: instanceID, } for i := range filesystems {