From 603c7785f7911ed97ced3efca63aefc9462c87f4 Mon Sep 17 00:00:00 2001 From: Kilian Cavalotti Date: Fri, 10 Feb 2017 13:38:22 -0800 Subject: [PATCH 1/4] MTM: add support for other vendors, in the form of vendor::model --- xCAT-genesis-scripts/bin/dodiscovery | 9 +++++++++ xCAT-server/lib/xcat/plugins/bmcdiscover.pm | 7 +++++++ 2 files changed, 16 insertions(+) diff --git a/xCAT-genesis-scripts/bin/dodiscovery b/xCAT-genesis-scripts/bin/dodiscovery index f1af844ff..8461c9f2b 100755 --- a/xCAT-genesis-scripts/bin/dodiscovery +++ b/xCAT-genesis-scripts/bin/dodiscovery @@ -72,6 +72,15 @@ if [ -r /sys/devices/virtual/dmi/id/product_name ]; then #x86 MTM=VMware else MTM=`cat /sys/devices/virtual/dmi/id/product_name|awk -F'[' '{print $2}'|awk -F']' '{print $1}'` + if [ -z "$MTM" ]; then + SYS=`cat /sys/devices/virtual/dmi/id/sys_vendor` + PRD=`cat /sys/devices/virtual/dmi/id/product_name` + if [ ! -z "$SYS" ]; then + MTM=${SYS^^}":"${PRD^^} + else + MTM=${PRD^^} + fi + fi SERIAL=`cat /sys/devices/virtual/dmi/id/product_serial` fi CPUCOUNT=`cat /proc/cpuinfo |grep "model name"|wc -l` diff --git a/xCAT-server/lib/xcat/plugins/bmcdiscover.pm b/xCAT-server/lib/xcat/plugins/bmcdiscover.pm index 18e3a09e2..8b4faf6b3 100644 --- a/xCAT-server/lib/xcat/plugins/bmcdiscover.pm +++ b/xCAT-server/lib/xcat/plugins/bmcdiscover.pm @@ -921,6 +921,13 @@ sub bmcdiscovery_ipmi { $serial = $2; last; } + + if (($fru_output =~ /Product Manufacturer\s+:\s+(.*?)\s+P.*?roduct Name\s+:\s+(.*?)\s+P.*?roduct Serial\s+:\s+(\S+)/)) { + $mtm = $1.":".$2; + $serial = $3; + last; + } + } } From 4bfdf4d90826b2d133ab2a6ad536bd56b6538abb Mon Sep 17 00:00:00 2001 From: Kilian Cavalotti Date: Fri, 10 Feb 2017 14:10:06 -0800 Subject: [PATCH 2/4] bmcdiscover: normalize nodename if mtm or serial contain unauthorized characters --- xCAT-server/lib/xcat/plugins/bmcdiscover.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/xCAT-server/lib/xcat/plugins/bmcdiscover.pm b/xCAT-server/lib/xcat/plugins/bmcdiscover.pm index 8b4faf6b3..b593236fb 100644 --- a/xCAT-server/lib/xcat/plugins/bmcdiscover.pm +++ b/xCAT-server/lib/xcat/plugins/bmcdiscover.pm @@ -946,6 +946,7 @@ sub bmcdiscovery_ipmi { if ($mtm and $serial) { $node = "node-$mtm-$serial"; $node =~ s/(.*)/\L$1/g; + $node =~ s/[\s:\._]/-/g; } } elsif ($output =~ /error : unauthorized name/) { xCAT::MsgUtils->message("E", { data => ["BMC username is incorrect for $ip"] }, $::CALLBACK); From c0c6082b138ba3c1d6f54247f70ff0c518d28e9b Mon Sep 17 00:00:00 2001 From: Kilian Cavalotti Date: Mon, 13 Feb 2017 10:57:26 -0800 Subject: [PATCH 3/4] dodiscovery: use information from FRU instead of DMI for MTM Don't use information from DMI to populate the MTM field, as there is no guarantee it will match with what's in the FRU pages. Since `bmcdiscover` uses FRU information, use it in `dosdiscovery` too so they will match for MTMS discovery. --- xCAT-genesis-scripts/bin/dodiscovery | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/xCAT-genesis-scripts/bin/dodiscovery b/xCAT-genesis-scripts/bin/dodiscovery index 8461c9f2b..5bb3bb894 100755 --- a/xCAT-genesis-scripts/bin/dodiscovery +++ b/xCAT-genesis-scripts/bin/dodiscovery @@ -73,14 +73,11 @@ if [ -r /sys/devices/virtual/dmi/id/product_name ]; then #x86 else MTM=`cat /sys/devices/virtual/dmi/id/product_name|awk -F'[' '{print $2}'|awk -F']' '{print $1}'` if [ -z "$MTM" ]; then - SYS=`cat /sys/devices/virtual/dmi/id/sys_vendor` - PRD=`cat /sys/devices/virtual/dmi/id/product_name` - if [ ! -z "$SYS" ]; then - MTM=${SYS^^}":"${PRD^^} - else - MTM=${PRD^^} - fi - fi + FRU=`ipmitool fru print 0` + if [ $? -eq 0 ]; then + MTM=`echo "$FRU" | awk -F': ' '/Product Manufacturer/ {m=$2} /Product Name/ {n=$2} END {print m":"n}'` + fi + fi SERIAL=`cat /sys/devices/virtual/dmi/id/product_serial` fi CPUCOUNT=`cat /proc/cpuinfo |grep "model name"|wc -l` From ed27765bf12978d5d98f9cacfe9a698abf5ba223 Mon Sep 17 00:00:00 2001 From: Kilian Cavalotti Date: Fri, 3 Mar 2017 09:30:28 -0800 Subject: [PATCH 4/4] fix indentation (tabs instead of spaces) --- xCAT-genesis-scripts/bin/dodiscovery | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xCAT-genesis-scripts/bin/dodiscovery b/xCAT-genesis-scripts/bin/dodiscovery index 5bb3bb894..6d20ba9da 100755 --- a/xCAT-genesis-scripts/bin/dodiscovery +++ b/xCAT-genesis-scripts/bin/dodiscovery @@ -73,10 +73,10 @@ if [ -r /sys/devices/virtual/dmi/id/product_name ]; then #x86 else MTM=`cat /sys/devices/virtual/dmi/id/product_name|awk -F'[' '{print $2}'|awk -F']' '{print $1}'` if [ -z "$MTM" ]; then - FRU=`ipmitool fru print 0` - if [ $? -eq 0 ]; then - MTM=`echo "$FRU" | awk -F': ' '/Product Manufacturer/ {m=$2} /Product Name/ {n=$2} END {print m":"n}'` - fi + FRU=`ipmitool fru print 0` + if [ $? -eq 0 ]; then + MTM=`echo "$FRU" | awk -F': ' '/Product Manufacturer/ {m=$2} /Product Name/ {n=$2} END {print m":"n}'` + fi fi SERIAL=`cat /sys/devices/virtual/dmi/id/product_serial` fi