xend: Count CPUs rather than relying on a static

nodes/sockets/cores/threads relationship.
Signed-off-by: Alex Williamson <alex.williamson@hp.com>
This commit is contained in:
kfraser@localhost.localdomain committed 2007-07-10 10:13:16 +01:00
1 parent a75c57c971
commit 503e2ed481
1 file changed
+7 -4
+7 -4
View File
@@ -580,14 +580,17 @@ class XendNode:
str='none\n'
return str[:-1];
def count_cpus(self, pinfo):
count=0
node_to_cpu=pinfo['node_to_cpu']
for i in range(0, pinfo['nr_nodes']):
count+=len(node_to_cpu[i])
return count;
def physinfo(self):
info = self.xc.physinfo()
info['nr_cpus'] = (info['nr_nodes'] *
info['sockets_per_node'] *
info['cores_per_socket'] *
info['threads_per_core'])
info['nr_cpus'] = self.count_cpus(info)
info['cpu_mhz'] = info['cpu_khz'] / 1000
# physinfo is in KiB, need it in MiB
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.