You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by am...@apache.org on 2015/10/13 20:00:05 UTC

[2/4] incubator-trafodion git commit: Wrong version traf_sqconfig. Fixed now.

Wrong version traf_sqconfig. Fixed now.


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/9d7ad261
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/9d7ad261
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/9d7ad261

Branch: refs/heads/master
Commit: 9d7ad261ebcd810cd7a6620aef118603fa2773e0
Parents: 78200ab
Author: Amanda Moran <am...@apache.com>
Authored: Tue Sep 29 22:01:20 2015 +0000
Committer: Amanda Moran <am...@apache.com>
Committed: Tue Sep 29 22:01:20 2015 +0000

----------------------------------------------------------------------
 install/installer/traf_sqconfig | 29 +++++++++++++++++++++--------
 1 file changed, 21 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/9d7ad261/install/installer/traf_sqconfig
----------------------------------------------------------------------
diff --git a/install/installer/traf_sqconfig b/install/installer/traf_sqconfig
index 4c6b372..9a79618 100755
--- a/install/installer/traf_sqconfig
+++ b/install/installer/traf_sqconfig
@@ -44,21 +44,34 @@ if [ "$node_count" -ne "1" ]; then
     #       file requires a range instead of a comma separated list.
     #       So, we convert the comma to a dash to cover this case.
     cores=$(lscpu | grep "CPU(s) list" | awk '{print $4}' | sed -e "s@,@-@" )
+    if [ "$cores" == "" ]; then
+        # NOTE: On some VM containers like OpenVZ (and maybe others)
+        #       lscpu cannot be used to get cores and cpus. So an
+        #       alternative is to use the info from /proc/cpuinfo.
+        echo "***INFO: cannot get cores from lscpu, trying from /proc/cpuinfo"
+        cores="0-$(($(cat /proc/cpuinfo | grep "processor" | sort -u | wc -l)-1))"
+    fi    
     maxCores=`echo $cores | sed 's/.*\-//'`
     if [[ "$maxCores" -gt "15" ]]; then
        cores="0-15"
     fi
+    
     processors=$(lscpu | grep "Socket(s)" | awk '{print $2}')
-
-    # On some VMs it seems that "Socket(s)" is not listed in
-    # lscpu so, we will default processors=1 in that case
     if [ "$processors" == "" ]; then
        processors=$(lscpu | grep "CPU socket(s)" | awk '{print $3}')
-       if [ "$processors" == "" ]; then
-          echo "***WARNING: unable to determine number of sockets with 'lscpu'..."
-          echo "***WARNING: ...defaulting sqconfig 'processors=1'"
-          processors="1"
-       fi
+    fi
+    if [ "$processors" == "" ]; then
+        # Trying also from /proc/cpuinfo.
+        echo "***INFO: cannot get processors from lscpu, trying from /proc/cpuinfo"
+        processors=$(cat /proc/cpuinfo | grep "physical id" | sort -u | wc -l)
+    fi    
+    # On some VMs it seems that "Socket(s)" is not listed in
+    # lscpu, so if we could neither get it from /proc/cpuinfo we will default
+    # processors=1 in that case
+    if [ "$processors" == "" ]; then
+        echo "***WARNING: unable to determine number of sockets with 'lscpu' or '/proc/cpuinfo' ..."
+        echo "***WARNING: ...defaulting sqconfig 'processors=1'"
+        processors="1"
     fi
     echo "#" >> $sqconfig
     echo "begin node" >> $sqconfig