meta-ampere: mtjade: correct virtual sensor expression
Correct expression to calculate nvme_bp_max and nvme_m2_max sensors in
case missing nvmeX sensors
Tested:
1. Unplug all NVMe drives, and check if they are all 0
2. Plug some in abitrary slots and check if they have correct values,
not n/a
Signed-off-by: Thang Q. Nguyen <thang@os.amperecomputing.com>
Change-Id: If0cc4e05b540394d15ed6bde3f04bcb13887477d
diff --git a/meta-ampere/meta-jade/recipes-phosphor/sensors/phosphor-virtual-sensor/virtual_sensor_config.json b/meta-ampere/meta-jade/recipes-phosphor/sensors/phosphor-virtual-sensor/virtual_sensor_config.json
index eabda2e..3bc8bf3 100644
--- a/meta-ampere/meta-jade/recipes-phosphor/sensors/phosphor-virtual-sensor/virtual_sensor_config.json
+++ b/meta-ampere/meta-jade/recipes-phosphor/sensors/phosphor-virtual-sensor/virtual_sensor_config.json
@@ -46,15 +46,11 @@
"Expression": "((P0 == P0) ? P0 : 0) + ((P1 == P1) ? P1 : 0)"
},
{
- "Desc": {
- "Name": "S1_CPU_Pwr",
- "SensorType": "power"
+ "Desc":{
+ "Name":"nvme_bp_max",
+ "SensorType":"temperature"
},
- "Threshold" :
- {
- "CriticalHigh": 500
- },
- "Associations":
+ "Associations":
[
[
"chassis",
@@ -67,31 +63,6 @@
"/xyz/openbmc_project/inventory/system/chassis/Mt_Jade"
]
],
- "Params": {
- "DbusParam": [
- {
- "ParamName": "P1",
- "Desc": {
- "Name": "S1_Core_VRD_Pwr",
- "SensorType": "power"
- }
- },
- {
- "ParamName": "P2",
- "Desc": {
- "Name": "S1_SOC_VRD_Pwr",
- "SensorType": "power"
- }
- }
- ]
- },
- "Expression": "(P1 + P2) >= 0 ? (P1 + P2) : NULL"
- },
- {
- "Desc":{
- "Name":"nvme_bp_max",
- "SensorType":"temperature"
- },
"Params":{
"DbusParam": [
{
@@ -264,13 +235,26 @@
}
]
},
- "Expression": "max(0,(n0 == n0) ? n0 : NULL,(n1 == n1) ? n1 : NULL,(n2 == n2) ? n2 : NULL,(n3 == n3) ? n3 : NULL,(n4 == n4) ? n4 : NULL,(n5 == n5) ? n5 : NULL,(n6 == n6) ? n6 : NULL,(n7 == n7) ? n7 : NULL,(n8 == n8) ? n8 : NULL,(n9 == n9) ? n9 : NULL,(n10 == n10) ? n10 : NULL,(n11 == n11) ? n11 : NULL,(n12 == n12) ? n12 : NULL,(n13 == n13) ? n13 : NULL,(n14 == n14) ? n14 : NULL,(n15 == n15) ? n15 : NULL,(n16 == n16) ? n16 : NULL,(n17 == n17) ? n17 : NULL,(n18 == n18) ? n18 : NULL,(n19 == n19) ? n19 : NULL,(n20 == n20) ? n20 : NULL,(n21 == n21) ? n21 : NULL,(n22 == n22) ? n22 : NULL,(n23 == n23) ? n23 : NULL)"
+ "Expression": "max((n0 == n0) ? n0 : 0,(n1 == n1) ? n1 : 0,(n2 == n2) ? n2 : 0,(n3 == n3) ? n3 : 0,(n4 == n4) ? n4 : 0,(n5 == n5) ? n5 : 0,(n6 == n6) ? n6 : 0,(n7 == n7) ? n7 : 0,(n8 == n8) ? n8 : 0,(n9 == n9) ? n9 : 0,(n10 == n10) ? n10 : 0,(n11 == n11) ? n11 : 0,(n12 == n12) ? n12 : 0,(n13 == n13) ? n13 : 0,(n14 == n14) ? n14 : 0,(n15 == n15) ? n15 : 0,(n16 == n16) ? n16 : 0,(n17 == n17) ? n17 : 0,(n18 == n18) ? n18 : 0,(n19 == n19) ? n19 : 0,(n20 == n20) ? n20 : 0,(n21 == n21) ? n21 : 0,(n22 == n22) ? n22 : 0,(n23 == n23) ? n23 : 0)"
},
{
"Desc":{
"Name":"nvme_m2_max",
"SensorType":"temperature"
},
+ "Associations":
+ [
+ [
+ "chassis",
+ "all_sensors",
+ "/xyz/openbmc_project/inventory/system/chassis/Mt_Jade"
+ ],
+ [
+ "inventory",
+ "sensors",
+ "/xyz/openbmc_project/inventory/system/chassis/Mt_Jade"
+ ]
+ ],
"Params":{
"DbusParam": [
{
@@ -289,7 +273,7 @@
}
]
},
- "Expression": "max(0,(n24 == n24) ? n24 : NULL,(n25 == n25) ? n25 : NULL)"
+ "Expression": "max((n24 == n24) ? n24 : 0,(n25 == n25) ? n25 : 0)"
}
]