920模组dmidcode -t 39无电源信息问题定位

1.问题现象:920模组 + openUBMC 环境下,OS侧执行dmidcode -t 39无信息

2.问题排查:

(1)dmidcode信息来源于SMBIOS;需要BIOS和BMC交互,BIOS请求BMC获取电源信息。

(2)从代码上看,当前openUBMC实现了获取电源信息接口GetPowerSupplyInfohttps://support.huawei.com/enterprise/zh/doc/EDOC1100372760/2ecd8d92

(3)至此,我们先抓取一下BIOS和BMC的交互报文

busctl --user call bmc.kepler.ipmi_core /bmc/kepler/Debug/IpmiCore/TraceIpmi bmc.kepler.Debug.IpmiCore.TraceIpmi Trace a{ss}bsyyss 0 true "bt" 0xff 0xff "" "file"
mdbctl
attach ipmi_core

a.从报文可以看到,BIOS并未下发该指令;但是却使用了另外一条ipmi指令https://support.huawei.com/enterprise/zh/doc/EDOC1100372760/1f5a78dd

抓取到的报文:

下发的指令是:Get Property Value For All Object Common Command

b.问题原因是:openUBMC已弃用该指令https://support.huawei.com/enterprise/zh/doc/EDOC1100372760/1f5a78dd,但920模组还在使用该指令。源问题

3.问题解决:重新开发接口

(1)在power_mgmt组件下ipmi.json文件添加接口

这里我们仅对OnePower实现

(2)执行bmcgo gen -r openubmc_dev生成代码,会生成如下代码

(3)在power_ipmi.lua文件中注册接口GetPropertyValueForOnePower

(4)实现接口GetPropertyValueForOnePower

local function create_property_handler(prop_name, info_id, data_type, default_value)

.......
end

-- OnePower 属性查询路由表
local property_handlers = {
    [2] = create_property_handler("Presence", INFO_IDS.PRESENCE, 'UINT8', 0),
    [3] = create_property_handler("Manufacturer", INFO_IDS.MANUFACTURER, 'STRING', "Unknown"),
    [4] = create_property_handler("Model", INFO_IDS.MODEL, 'STRING', "Unknown"),
    [6] = create_property_handler("Rate", INFO_IDS.RATED_POWER, 'UINT16', 0),
    [9] = create_property_handler("FirmwareVersion", INFO_IDS.FIRMWARE, 'STRING', "Unknown"),
    [20] = create_property_handler("SerialNumber", INFO_IDS.SERIAL, 'STRING', "Unknown"),
    [21] = create_property_handler("PartNumber", INFO_IDS.PART_NUMBER, 'STRING', "Unknown"),
    [28] = create_property_handler("Location", INFO_IDS.LOCATION, 'STRING', "chassis"),
    [31] = create_property_handler("PowerSupplyType", INFO_IDS.POWER_TYPE, 'UINT8', 4),
    [32] = create_property_handler("InputVoltageSwitchMode", INFO_IDS.VOLTAGE_SWITCH, 'UINT8', 4),
    [33] = create_property_handler("HotPlugSupport", INFO_IDS.HOTPLUG, 'UINT8', 1),
}

local function get_property_value_for_onepower(req, ctx)
    if not req.Data or #req.Data < 4 then
        return msg.GetPropertyValueForOnePowerRsp.new(
            comp_code.ParmOutOfRange, 
            req.ManufactureId or 0, 
            0, 
            "0"
        )
    end

    local prop_id = string.unpack('<H', string.sub(req.Data, 3, 4))

    local handler = property_handlers[prop_id]
    if not handler then
        return msg.GetPropertyValueForOnePowerRsp.new(
            comp_code.InvalidFieldRequest, 
            req.ManufactureId, 
            0, 
            "0"
        )
    end

    return handler(psu_service.get_instance(), req)
end
2 个赞