From 7b68fe1a5e17de3b48efb1b58d6aa4bf4cf9f6dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Fri, 29 Oct 2021 10:08:03 +0100 Subject: [PATCH] virtinst: take account of 'dies' when calc vcpu count from topology MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Daniel P. Berrangé --- tests/test_misc.py | 6 ++++++ virtinst/domain/cpu.py | 1 + 2 files changed, 7 insertions(+) diff --git a/tests/test_misc.py b/tests/test_misc.py index 2dced1e8c..7a56e1341 100644 --- a/tests/test_misc.py +++ b/tests/test_misc.py @@ -47,6 +47,12 @@ def test_misc_cpu_topology(): cpu.topology.cores = 2 assert cpu.vcpus_from_topology() == 10 + cpu = virtinst.DomainCpu(conn) + cpu.topology.sockets = 3 + cpu.topology.dies = 2 + cpu.topology.cores = 2 + assert cpu.vcpus_from_topology() == 12 + cpu = virtinst.DomainCpu(conn) assert cpu.vcpus_from_topology() == 1 diff --git a/virtinst/domain/cpu.py b/virtinst/domain/cpu.py index b7ca764c0..dfc8bb435 100644 --- a/virtinst/domain/cpu.py +++ b/virtinst/domain/cpu.py @@ -365,6 +365,7 @@ class DomainCpu(XMLBuilder): no topology is set """ return ((self.topology.sockets or 1) * + (self.topology.dies or 1) * (self.topology.cores or 1) * (self.topology.threads or 1))