Commit f43c898d authored by Bernardo Dal Seno's avatar Bernardo Dal Seno
Browse files

Export CPUs used by the node OS



They are exported through the LUXI, RAPI, and IAllocator interfaces.
Signed-off-by: default avatarBernardo Dal Seno <bdalseno@google.com>
Reviewed-by: default avatarKlaus Aehlig <aehlig@google.com>
parent ff05ff94
......@@ -657,6 +657,8 @@ class IAllocator(object):
"free_spindles": free_spindles,
"total_cpus": self._GetAttributeFromHypervisorNodeData(
hv_info, ninfo.name, "cpu_total"),
"reserved_cpus": self._GetAttributeFromHypervisorNodeData(
hv_info, ninfo.name, "cpu_dom0"),
"i_pri_memory": i_p_mem,
"i_pri_up_memory": i_p_up_mem,
}
......
......@@ -1154,6 +1154,8 @@ _NODE_LIVE_FIELDS = {
" for detecting reboots by tracking changes"),
"cnodes": ("CNodes", QFT_NUMBER, "cpu_nodes",
"Number of NUMA domains on node (if exported by hypervisor)"),
"cnos": ("CNOs", QFT_NUMBER, "cpu_dom0",
"Number of logical processors used by the node OS (dom0 for Xen)"),
"csockets": ("CSockets", QFT_NUMBER, "cpu_sockets",
"Number of physical CPU sockets (if exported by hypervisor)"),
"ctotal": ("CTotal", QFT_NUMBER, "cpu_total", "Number of logical processors"),
......
......@@ -84,7 +84,7 @@ N_FIELDS = ["name", "offline", "master_candidate", "drained",
"dtotal", "dfree", "sptotal", "spfree",
"mtotal", "mnode", "mfree",
"pinst_cnt", "sinst_cnt",
"ctotal", "cnodes", "csockets",
"ctotal", "cnos", "cnodes", "csockets",
"pip", "sip", "role",
"pinst_list", "sinst_list",
"master_capable", "vm_capable",
......
......@@ -57,6 +57,8 @@ nodeLiveFieldsDefs =
\ for detecting reboots by tracking changes")
, ("cnodes", "CNodes", QFTNumber, "cpu_nodes",
"Number of NUMA domains on node (if exported by hypervisor)")
, ("cnos", "CNOs", QFTNumber, "cpu_dom0",
"Number of logical processors used by the node OS (dom0 for Xen)")
, ("csockets", "CSockets", QFTNumber, "cpu_sockets",
"Number of physical CPU sockets (if exported by hypervisor)")
, ("ctotal", "CTotal", QFTNumber, "cpu_total",
......@@ -84,6 +86,8 @@ nodeLiveFieldExtract "bootid" res =
J.showJSON $ rpcResNodeInfoBootId res
nodeLiveFieldExtract "cnodes" res =
jsonHead (rpcResNodeInfoHvInfo res) hvInfoCpuNodes
nodeLiveFieldExtract "cnos" res =
jsonHead (rpcResNodeInfoHvInfo res) hvInfoCpuDom0
nodeLiveFieldExtract "csockets" res =
jsonHead (rpcResNodeInfoHvInfo res) hvInfoCpuSockets
nodeLiveFieldExtract "ctotal" res =
......
......@@ -357,6 +357,7 @@ $(buildObject "HvInfo" "hvInfo"
, simpleField "cpu_total" [t| Int |]
, simpleField "cpu_nodes" [t| Int |]
, simpleField "cpu_sockets" [t| Int |]
, simpleField "cpu_dom0" [t| Int |]
])
$(buildObject "RpcResultNodeInfo" "rpcResNodeInfo"
......
......@@ -429,6 +429,7 @@ class TestNodeQuery(unittest.TestCase):
fake_live_data = {
"bootid": "a2504766-498e-4b25-b21e-d23098dc3af4",
"cnodes": 4,
"cnos": 3,
"csockets": 4,
"ctotal": 8,
"mnode": 128,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment