diff options
author | George Hung <george.hung@quantatw.com> | 2021-04-08 02:36:01 +0300 |
---|---|---|
committer | George Hung <george.hung@quantatw.com> | 2021-04-08 04:39:13 +0300 |
commit | b3464d089a40bc67af0ee842f40930e5e3b4020c (patch) | |
tree | a02890b05c8f5d3ec3a35c0d5383e94edb5cf3d0 /meta-quanta/meta-gbs | |
parent | aa5d011d280be228c97fa8c681632d76e7c05f75 (diff) | |
download | openbmc-b3464d089a40bc67af0ee842f40930e5e3b4020c.tar.xz |
meta-quanta: gbs: populated the JSON according to the installed drives
Add the @nvmeList@ template and dynamically detect for which
drives we should have and populated the JSON accordingly
Signed-off-by: George Hung <george.hung@quantatw.com>
Change-Id: Id0f6cefe80ae72dc8d3601d0a03dd1039341175c
Diffstat (limited to 'meta-quanta/meta-gbs')
-rw-r--r-- | meta-quanta/meta-gbs/recipes-quanta/fans/read-margin-temp/config-margin.json.in | 17 | ||||
-rw-r--r-- | meta-quanta/meta-gbs/recipes-quanta/fans/read-margin-temp/read-margin-temp-wait.sh | 22 |
2 files changed, 16 insertions, 23 deletions
diff --git a/meta-quanta/meta-gbs/recipes-quanta/fans/read-margin-temp/config-margin.json.in b/meta-quanta/meta-gbs/recipes-quanta/fans/read-margin-temp/config-margin.json.in index f152db996..a5ff4979b 100644 --- a/meta-quanta/meta-gbs/recipes-quanta/fans/read-margin-temp/config-margin.json.in +++ b/meta-quanta/meta-gbs/recipes-quanta/fans/read-margin-temp/config-margin.json.in @@ -391,22 +391,7 @@ "zoneSetpoint": 10000, "target": "/xyz/openbmc_project/extsensors/margin/nvme", "components": [ - "nvme0", - "nvme1", - "nvme2", - "nvme3", - "nvme4", - "nvme5", - "nvme6", - "nvme7", - "nvme8", - "nvme9", - "nvme10", - "nvme11", - "nvme12", - "nvme13", - "nvme14", - "nvme15" + @nvmeList@ ] }, { diff --git a/meta-quanta/meta-gbs/recipes-quanta/fans/read-margin-temp/read-margin-temp-wait.sh b/meta-quanta/meta-gbs/recipes-quanta/fans/read-margin-temp/read-margin-temp-wait.sh index 23742a687..992e40a71 100644 --- a/meta-quanta/meta-gbs/recipes-quanta/fans/read-margin-temp/read-margin-temp-wait.sh +++ b/meta-quanta/meta-gbs/recipes-quanta/fans/read-margin-temp/read-margin-temp-wait.sh @@ -15,29 +15,37 @@ done nvmePath="/xyz/openbmc_project/sensors/temperature/nvme" nvmeInventoryPath="/xyz/openbmc_project/inventory/system/chassis/motherboard/nvme" +nvmeList="" # Get and Set WCTEMP for ((i = 0; i < 16; i++)); do name="@WCTemp$(printf "%02d" $i)@" wcTemp=72000 - presentState=$(busctl get-property \ + presentState="$(busctl get-property \ xyz.openbmc_project.Inventory.Manager \ ${nvmeInventoryPath}${i} \ xyz.openbmc_project.Inventory.Item \ - Present | awk '{print $2}') + Present | awk '{print $2}')" - if [[ $presentState == "true" ]]; then - wcTemp=$( + if [[ "$presentState" == "true" ]]; then + wcTemp="$( busctl get-property xyz.openbmc_project.nvme.manager \ ${nvmePath}${i} \ xyz.openbmc_project.Sensor.Threshold.Critical \ CriticalHigh | awk '{print $2}' - ) - wcTemp=$((wcTemp * 1000)) + )" + wcTemp="$((wcTemp * 1000))" + if [[ -z "$nvmeList" ]]; then + nvmeList="\"nvme"${i}"\"" + else + nvmeList="${nvmeList}"", \"nvme"${i}"\"" + fi fi - sed -i "s/$name/${wcTemp}/g" $TEMP_FILE + sed -i "s/$name/${wcTemp}/g" "$TEMP_FILE" done +sed -i "s/@nvmeList@/${nvmeList}/g" "$TEMP_FILE" + # Use shell parameter expansion to trim the ".in" suffix mv "$TEMP_FILE" "${MARGIN_TABLE_FILE_IN%".in"}" |