debuggers.hg

changeset 20863:7a8cee80597e

xend: Use max_node_id rather than nr_nodes where appropriate.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Sun Jan 17 18:20:04 2010 +0000 (2010-01-17)
parents 757359a36785
children 508f457aa439
files tools/python/xen/xend/XendDomainInfo.py tools/python/xen/xend/XendNode.py
line diff
     1.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Sun Jan 17 18:07:10 2010 +0000
     1.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Sun Jan 17 18:20:04 2010 +0000
     1.3 @@ -2690,7 +2690,7 @@ class XendDomainInfo:
     1.4          else:
     1.5              def find_relaxed_node(node_list):
     1.6                  import sys
     1.7 -                nr_nodes = info['nr_nodes']
     1.8 +                nr_nodes = info['max_node_id']+1
     1.9                  if node_list is None:
    1.10                      node_list = range(0, nr_nodes)
    1.11                  nodeload = [0]
    1.12 @@ -2722,12 +2722,12 @@ class XendDomainInfo:
    1.13                  node_memory_list = info['node_to_memory']
    1.14                  needmem = self.image.getRequiredAvailableMemory(self.info['memory_dynamic_max']) / 1024
    1.15                  candidate_node_list = []
    1.16 -                for i in range(0, info['nr_nodes']):
    1.17 +                for i in range(0, info['max_node_id']+1):
    1.18                      if node_memory_list[i] >= needmem and len(info['node_to_cpu'][i]) > 0:
    1.19                          candidate_node_list.append(i)
    1.20                  best_node = find_relaxed_node(candidate_node_list)[0]
    1.21                  cpumask = info['node_to_cpu'][best_node]
    1.22 -                best_nodes = find_relaxed_node(filter(lambda x: x != best_node, range(0,info['nr_nodes'])))
    1.23 +                best_nodes = find_relaxed_node(filter(lambda x: x != best_node, range(0,info['max_node_id']+1)))
    1.24                  for node_idx in best_nodes:
    1.25                      if len(cpumask) >= self.info['VCPUs_max']:
    1.26                          break
    1.27 @@ -2754,9 +2754,9 @@ class XendDomainInfo:
    1.28              while (retries > 0):
    1.29                  physinfo = xc.physinfo()
    1.30                  free_mem = physinfo['free_memory']
    1.31 -                nr_nodes = physinfo['nr_nodes']
    1.32 +                max_node_id = physinfo['max_node_id']
    1.33                  node_to_dma32_mem = physinfo['node_to_dma32_mem']
    1.34 -                if (node > nr_nodes):
    1.35 +                if (node > max_node_id):
    1.36                      return
    1.37                  # Extra 2MB above 64GB seems to do the trick.
    1.38                  need_mem = 64 * 1024 + 2048 - node_to_dma32_mem[node]
     2.1 --- a/tools/python/xen/xend/XendNode.py	Sun Jan 17 18:07:10 2010 +0000
     2.2 +++ b/tools/python/xen/xend/XendNode.py	Sun Jan 17 18:20:04 2010 +0000
     2.3 @@ -879,7 +879,7 @@ class XendNode:
     2.4          whitespace=''
     2.5          try:
     2.6              node_to_cpu=pinfo['node_to_cpu']
     2.7 -            for i in range(0, pinfo['nr_nodes']):
     2.8 +            for i in range(0, pinfo['max_node_id']+1):
     2.9                  str+='%snode%d:%s\n' % (whitespace,
    2.10                                          i, 
    2.11                                        self.list_to_strrange(node_to_cpu[i]))
    2.12 @@ -892,7 +892,7 @@ class XendNode:
    2.13          whitespace=''
    2.14          try:
    2.15              node_to_memory=pinfo[key]
    2.16 -            for i in range(0, pinfo['nr_nodes']):
    2.17 +            for i in range(0, pinfo['max_node_id']+1):
    2.18                  str+='%snode%d:%d\n' % (whitespace,
    2.19                                          i,
    2.20                                          node_to_memory[i] / 1024)
    2.21 @@ -927,7 +927,8 @@ class XendNode:
    2.22                        'free_memory',
    2.23                        'node_to_cpu',
    2.24                        'node_to_memory',
    2.25 -                      'node_to_dma32_mem'
    2.26 +                      'node_to_dma32_mem',
    2.27 +                      'max_node_id'
    2.28                        ]
    2.29  
    2.30          return [[k, info[k]] for k in ITEM_ORDER]