From 4337cf1b1c2f0c1bf29ec1537404d7415b5524cb Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Mon, 5 May 2008 10:03:39 +0000 Subject: [PATCH] Export the number of cpus to iallocator scripts 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 | 9 +++++++++ lib/cmdlib.py | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/doc/iallocator.sgml b/doc/iallocator.sgml index 3d0e5af24..0cf1826cf 100644 --- a/doc/iallocator.sgml +++ b/doc/iallocator.sgml @@ -319,6 +319,15 @@ instances which are down on the node</simpara> </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> diff --git a/lib/cmdlib.py b/lib/cmdlib.py index f73a976ce..2752592a6 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -4938,7 +4938,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)) @@ -4967,6 +4967,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 -- GitLab