[NEW PATCH] Return 1 socket when "physical id" not present (via gerrit-bot)

Federico Simoncelli fsimonce at redhat.com
Wed Jul 6 14:54:11 UTC 2011


New patch submitted by Federico Simoncelli (fsimonce at redhat.com)

You can review this change at: http://gerrit.usersys.redhat.com/666

commit 532621aaab3c287a285100e94957db3f7d691331
Author: Federico Simoncelli <fsimonce at redhat.com>
Date:   Wed Jul 6 11:52:09 2011 +0000

    Return 1 socket when "physical id" not present
    
    When "physical id" is not present in /proc/cpuinfo return 1 socket.
    
    Change-Id: If25e97830d35286b32083f57156ebb97a0e1aeb0

diff --git a/vdsm/caps.py b/vdsm/caps.py
index e943321..57a1bbf 100644
--- a/vdsm/caps.py
+++ b/vdsm/caps.py
@@ -44,7 +44,8 @@ class CpuInfo(object):
         return len(self._info)
 
     def sockets(self):
-        return len(set([ p['physical id'] for p in self._info.values() ]))
+        phys_ids = [ p.get('physical id', '0') for p in self._info.values() ]
+        return len(set(phys_ids))
 
     def flags(self):
         return self._info.itervalues().next()['flags'].split()




More information about the vdsm-patches mailing list