Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix MTM detection for incomplete FRU pages #7398

Merged
merged 3 commits into from
Feb 19, 2024

Conversation

kcgthb
Copy link
Member

@kcgthb kcgthb commented Jul 27, 2023

The PR is to fix issue #7397

When FRU pages include empty fields (more precisely blank fields that are just spaces), the FRU parsing in dodiscovery returns blank values.

This PR makes sure that blank fields containing only spaces are ignored, so the correct field can be returned.

For instance, with the following FRU page:

# ipmitool fru print 0
 Chassis Type          : Other
 Chassis Part Number   : CSE-228GTS-R2K21P
 Chassis Serial        : [redacted]
 Board Mfg Date        : Sun Apr 23 04:33:00 2023 PDT
 Board Mfg             : Supermicro
 Board Product         : H12DSG-Q-CPU6
 Board Serial          : [redacted]
 Board Part Number     : H12DSG-Q-CPU6
 Product Manufacturer  : Supermicro
 Product Name          :
 Product Part Number   : AS -2124GQ-NART
 Product Version       :
 Product Serial        : [redacted]
 Product Asset Tag     :

the original dodiscovery script returns

# ipmitool fru print 0 | awk -F': ' '/Product Manufacturer/ {m=$2} /Product Name|Product Part Number/ {if (n==""||n=="NONE") {n=$2}} END {print m":"n}'
Supermicro:

And with the fix:

# ipmitool fru print 0 | awk -F': ' '/Product Manufacturer/ {m=$2} /Product Name|Product Part Number/ {if (n==""||n~/ +/||n=="NONE") {n=$2}} END {print m":"n}'
Supermicro:AS -2124GQ-NART

@@ -94,7 +94,7 @@ if [ -r /sys/devices/virtual/dmi/id/product_name ]; then #x86
if [ -z "$MTM" ]; then
FRU=`ipmitool fru print 0`
if [ $? -eq 0 ]; then
MTM=`echo "$FRU" | awk -F': ' '/Product Manufacturer/ {m=$2} /Product Name|Product Part Number/ {if (n==""||n=="NONE") {n=$2}} END {print m":"n}'`
MTM=`echo "$FRU" | awk -F': ' '/Product Manufacturer/ {m=$2} /Product Name|Product Part Number/ {if (n==""||n~/ +/||n=="NONE") {n=$2}} END {print m":"n}'`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kcgthb Killian, how about changing ~/ +/ to ~/\s+/ to handle all whitespace?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good suggestion, thank you!

I've never seen a non-space whitespace character in a FRU field yet, but well, until recently and the Supermicro "AS- " line of servers, I had never seen a space either, so 🤷

@Obihoernchen Obihoernchen added this to the 2.17 milestone Jan 24, 2024
@Obihoernchen Obihoernchen merged commit 86c8b33 into xcat2:master Feb 19, 2024
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants