summaryrefslogtreecommitdiff
path: root/virtinst/domain
diff options
context:
space:
mode:
authorDaniel P. Berrangé <berrange@redhat.com>2021-10-29 13:31:12 +0100
committerCole Robinson <crobinso@redhat.com>2022-01-20 14:16:39 -0500
commit883419c2144cf8d236589d873f016e0472774ace (patch)
treef79a2bbdf75ef97668c4bbe62a4b7c8e12f8b7f6 /virtinst/domain
parent9a578e1ac58eccd7b7a8123ce7fe22cbf8080b3a (diff)
downloadvirt-manager-883419c2144cf8d236589d873f016e0472774ace.tar.gz
virtinst: allow to force create topology from scratch
When setting CPU defaults we want to force create the topology even if the user has not specified anything. In particular this allows for overriding the QEMU defaults, to expose vCPUs as cores instead of sockets which is a much saner default for Windows. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Diffstat (limited to 'virtinst/domain')
-rw-r--r--virtinst/domain/cpu.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/virtinst/domain/cpu.py b/virtinst/domain/cpu.py
index f6f9eabb..22a90d3a 100644
--- a/virtinst/domain/cpu.py
+++ b/virtinst/domain/cpu.py
@@ -401,13 +401,14 @@ class DomainCpu(XMLBuilder):
"""
return bool(self.topology.get_xml())
- def set_topology_defaults(self, vcpus):
+ def set_topology_defaults(self, vcpus, create=False):
"""
Fill in unset topology values, using the passed vcpus count.
- Will not set topology from scratch, this just fills in missing
- topology values.
+ If @create is False, this will not set topology from scratch,
+ just fill in missing topology values.
+ If @create is True, this will create topology from scratch.
"""
- if not self.has_topology():
+ if not self.has_topology() and not create:
return
self.topology.set_defaults_from_vcpus(vcpus)