virtinst: take account of 'dies' when calc vcpu count from topology

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrangé 2021-10-29 10:08:03 +01:00 committed by Cole Robinson
parent 95eb8dda9b
commit 7b68fe1a5e
2 changed files with 7 additions and 0 deletions

View File

@ -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

View File

@ -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))