libvirt: Add NUMA cell count to cpu_info

Adds the number of NUMA cells from libvirt to the cpu_info['topology']
attribute, so that clients using that data for socket/core/thread
counting on hypervisors can get better-quality results.

Closes-Bug: 1156456
Change-Id: I945f32bce96f27939d39b86af6ccec73b754f886
This commit is contained in:
Nicolas Simonds 2015-09-14 18:57:46 -07:00
parent 8ca81142ed
commit 9aec873f75
2 changed files with 4 additions and 1 deletions

View File

@ -9568,6 +9568,7 @@ class LibvirtConnTestCase(test.NoDBTestCase):
cpu.vendor = "AMD"
cpu.arch = arch.X86_64
cpu.cells = 1
cpu.cores = 2
cpu.threads = 1
cpu.sockets = 4
@ -9600,7 +9601,8 @@ class LibvirtConnTestCase(test.NoDBTestCase):
"features": set(["extapic", "3dnow"]),
"model": "Opteron_G4",
"arch": arch.X86_64,
"topology": {"cores": 2, "threads": 1, "sockets": 4}}
"topology": {"cells": 1, "cores": 2, "threads": 1,
"sockets": 4}}
got = drvr._get_cpu_info()
self.assertEqual(want, got)

View File

@ -4717,6 +4717,7 @@ class LibvirtDriver(driver.ComputeDriver):
cpu_info['vendor'] = caps.host.cpu.vendor
topology = dict()
topology['cells'] = len(getattr(caps.host.topology, 'cells', [1]))
topology['sockets'] = caps.host.cpu.sockets
topology['cores'] = caps.host.cpu.cores
topology['threads'] = caps.host.cpu.threads