简单修改ipmitool代码,让工具支持LUN显示。
主要影响两个命令ipmitool sdr elist 和ipmitool sel elist
--- ipmitool-1.8.18/lib/ipmi_sdr.c 2016-05-30 03:56:30.000000000 +0800
+++ ipmitool-1.8.18x2/lib/ipmi_sdr.c 2021-05-28 13:41:11.000000000 +0800
@@ -1655,8 +1655,8 @@ ipmi_sdr_print_sensor_fc(struct ipmi_int
/*
* print sensor name, number, state, entity, reading
*/
- printf("%-16s | %02Xh | ",
- sr->s_id, sensor->keys.sensor_num);
+ printf("%-16s | %02X.%02Xh | ",
+ sr->s_id, sensor->keys.sensor_num, sensor->keys.lun);
if (IS_THRESHOLD_SENSOR(sensor)) {
/* Threshold Analog & Discrete */
@@ -2105,9 +2105,9 @@ ipmi_sdr_print_sensor_eventonly(struct i
sensor->keys.sensor_num,
sensor->entity.id, sensor->entity.instance);
else if (sdr_extended)
- printf("%-16s | %02Xh | ns | %2d.%1d | Event-Only\n",
+ printf("%-16s | %02X.%02Xh | ns | %2d.%1d | Event-Only\n",
sensor->id_code ? desc : "",
- sensor->keys.sensor_num,
+ sensor->keys.sensor_num,sensor->keys.lun,
sensor->entity.id, sensor->entity.instance);
else
printf("%-16s | Event-Only | ns\n",
@@ -3230,6 +3230,7 @@ ipmi_sdr_find_sdr_bynumtype(struct ipmi_
case SDR_RECORD_TYPE_COMPACT_SENSOR:
if (e->record.common->keys.sensor_num == num &&
e->record.common->keys.owner_id == (gen_id & 0x00ff) &&
+ e->record.common->keys.lun == ((gen_id & 0xff00)>>8) &&
e->record.common->sensor.type == type)
return e;
break;
@@ -3272,6 +3273,7 @@ ipmi_sdr_find_sdr_bynumtype(struct ipmi_
(struct sdr_record_common_sensor *) rec;
if (sdrr->record.common->keys.sensor_num == num
&& sdrr->record.common->keys.owner_id == (gen_id & 0x00ff)
+ && sdrr->record.common->keys.lun == ((gen_id & 0xff00)>>8)
&& sdrr->record.common->sensor.type == type)
found = 1;
break;
Tags:
ipmitool lun
ipmitool lun