Revision e8a4c138

b/lib/cmdlib.py
1492 1492
    This checks that the fields required are valid output fields.
1493 1493

  
1494 1494
    """
1495
    self.dynamic_fields = frozenset(["dtotal", "dfree",
1496
                                     "mtotal", "mnode", "mfree",
1497
                                     "bootid"])
1495
    self.dynamic_fields = frozenset([
1496
      "dtotal", "dfree",
1497
      "mtotal", "mnode", "mfree",
1498
      "bootid",
1499
      "ctotal",
1500
      ])
1498 1501

  
1499 1502
    _CheckOutputFields(static=["name", "pinst_cnt", "sinst_cnt",
1500 1503
                               "pinst_list", "sinst_list",
......
1525 1528
            "mfree": utils.TryConvert(int, nodeinfo['memory_free']),
1526 1529
            "dtotal": utils.TryConvert(int, nodeinfo['vg_size']),
1527 1530
            "dfree": utils.TryConvert(int, nodeinfo['vg_free']),
1531
            "ctotal": utils.TryConvert(int, nodeinfo['cpu_total']),
1528 1532
            "bootid": nodeinfo['bootid'],
1529 1533
            }
1530 1534
        else:
b/lib/constants.py
25 25

  
26 26
# various versions
27 27
CONFIG_VERSION = 3
28
PROTOCOL_VERSION = 11
28
PROTOCOL_VERSION = 12
29 29
RELEASE_VERSION = _autoconf.PACKAGE_VERSION
30 30
OS_API_VERSION = 5
31 31
EXPORT_VERSION = 0
b/lib/hypervisor/FakeHypervisor.py
25 25

  
26 26
import os
27 27
import os.path
28
import re
28 29

  
29 30
from ganeti import utils
30 31
from ganeti import constants
......
186 187
          sum_free += int(val.split()[0])/1024
187 188
        elif key == 'Active':
188 189
          result['memory_dom0'] = int(val.split()[0])/1024
189

  
190 190
    result['memory_free'] = sum_free
191

  
192
    cpu_total = 0
193
    try:
194
      fh = open("/proc/cpuinfo")
195
      try:
196
        cpu_total = len(re.findall("(?m)^processor\s*:\s*[0-9]+\s*$",
197
                                   fh.read()))
198
      finally:
199
        fh.close()
200
    except EnvironmentError, err:
201
      raise HypervisorError("Failed to list node info: %s" % err)
202
    result['cpu_total'] = cpu_total
203

  
191 204
    return result
192 205

  
193 206
  @staticmethod
b/lib/hypervisor/XenHypervisor.py
199 199
          result['memory_total'] = int(val)
200 200
        elif key == 'free_memory':
201 201
          result['memory_free'] = int(val)
202
        elif key == 'nr_cpus':
203
          result['cpu_total'] = int(val)
202 204
    dom0_info = self.GetInstanceInfo("Domain-0")
203 205
    if dom0_info is not None:
204 206
      result['memory_dom0'] = dom0_info[2]
b/scripts/gnt-node
56 56
  output = SubmitOpCode(op)
57 57

  
58 58
  if not opts.no_headers:
59
    headers = {"name": "Node", "pinst_cnt": "Pinst", "sinst_cnt": "Sinst",
60
               "pinst_list": "PriInstances", "sinst_list": "SecInstances",
61
               "pip": "PrimaryIP", "sip": "SecondaryIP",
62
               "dtotal": "DTotal", "dfree": "DFree",
63
               "mtotal": "MTotal", "mnode": "MNode", "mfree": "MFree",
64
               "bootid": "BootID"}
59
    headers = {
60
      "name": "Node", "pinst_cnt": "Pinst", "sinst_cnt": "Sinst",
61
      "pinst_list": "PriInstances", "sinst_list": "SecInstances",
62
      "pip": "PrimaryIP", "sip": "SecondaryIP",
63
      "dtotal": "DTotal", "dfree": "DFree",
64
      "mtotal": "MTotal", "mnode": "MNode", "mfree": "MFree",
65
      "bootid": "BootID",
66
      "ctotal": "CTotal",
67
      }
65 68
  else:
66 69
    headers = None
67 70

  
......
72 75

  
73 76
  numfields = ["dtotal", "dfree",
74 77
               "mtotal", "mnode", "mfree",
75
               "pinst_cnt", "sinst_cnt"]
78
               "pinst_cnt", "sinst_cnt",
79
               "ctotal"]
76 80

  
77 81
  # change raw values to nicer strings
78 82
  for row in output:
......
309 313
           "", "Lists the nodes in the cluster. The available fields"
310 314
           " are (see the man page for details): name, pinst_cnt, pinst_list,"
311 315
           " sinst_cnt, sinst_list, pip, sip, dtotal, dfree, mtotal, mnode,"
312
           " mfree, bootid. The default field list is (in order): name,"
316
           " mfree, bootid, cpu_count. The default field list is"
317
           " (in order): name,"
313 318
           " dtotal, dfree, mtotal, mnode, mfree, pinst_cnt, sinst_cnt."),
314 319
  'remove': (RemoveNode, ARGS_ONE, [DEBUG_OPT],
315 320
             "<node_name>", "Removes a node from the cluster"),

Also available in: Unified diff