Export the number of cpus to iallocator scripts
authorIustin Pop <iustin@google.com>
Mon, 5 May 2008 09:41:33 +0000 (09:41 +0000)
committerIustin Pop <iustin@google.com>
Mon, 5 May 2008 09:41:33 +0000 (09:41 +0000)
Now that we have the number of cpus available from the hypervisors, we
can export this to the iallocator scripts.

Reviewed-by: ultrotter

doc/iallocator.sgml
lib/cmdlib.py

index 3d0e5af..0cf1826 100644 (file)
                 </listitem>
               </varlistentry>
               <varlistentry>
+                <term>total_cpus</term>
+                <listitem>
+                  <simpara>the physical number of CPUs present on the
+                  machine; depending on the hypervisor, this might or
+                  might not be equal to how many CPUs the node
+                  operating system sees;</simpara>
+                </listitem>
+              </varlistentry>
+              <varlistentry>
                 <term>primary_ip</term>
                 <listitem>
                   <simpara>the primary IP address of the
index 203c69c..095e5b1 100644 (file)
@@ -5130,7 +5130,7 @@ class IAllocator(object):
         raise errors.OpExecError("Can't get data for node %s" % nname)
       remote_info = node_data[nname]
       for attr in ['memory_total', 'memory_free', 'memory_dom0',
-                   'vg_size', 'vg_free']:
+                   'vg_size', 'vg_free', 'cpu_total']:
         if attr not in remote_info:
           raise errors.OpExecError("Node '%s' didn't return attribute '%s'" %
                                    (nname, attr))
@@ -5159,6 +5159,7 @@ class IAllocator(object):
         "free_disk": remote_info['vg_free'],
         "primary_ip": ninfo.primary_ip,
         "secondary_ip": ninfo.secondary_ip,
+        "total_cpus": remote_info['cpu_total'],
         }
       node_results[nname] = pnr
     data["nodes"] = node_results