Skip to content
This repository was archived by the owner on Jan 22, 2026. It is now read-only.

Commit a077402

Browse files
committed
Fix use of --accelerate argument
1 parent c1f1de2 commit a077402

2 files changed

Lines changed: 20 additions & 8 deletions

File tree

virt-install

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ def parse_args():
230230
help=_("set up keymap for a graphical console"))
231231

232232
parser.add_option("", "--accelerate", action="store_true", dest="accelerate",
233-
help=_("Use kernel acceleration capabilities"))
233+
help=_("Use kernel acceleration capabilities"), default=False)
234234
parser.add_option("", "--connect", type="string", dest="connect",
235235
action="callback", callback=cli.check_before_store,
236236
help=_("Connect to hypervisor with URI"),
@@ -351,10 +351,8 @@ def main():
351351

352352
if options.fullvirt:
353353
os_type = "hvm"
354-
elif options.paravirt:
355-
os_type = "xen"
356354
else:
357-
os_type = None
355+
os_type = "xen"
358356

359357
guest = capabilities.guestForOSType(type=os_type, arch=options.arch)
360358
if guest is None:
@@ -366,7 +364,7 @@ def main():
366364
else:
367365
hvm = False
368366

369-
domain = guest.bestDomainType()
367+
domain = guest.bestDomainType(options.accelerate)
370368
type = domain.hypervisor_type
371369

372370
if options.livecd:

virtinst/CapabilitiesParser.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,23 @@ def parseXML(self, node):
159159
child = child.next
160160

161161

162-
def bestDomainType(self):
163-
# Picking last in list so we favour KVM/KQEMU over QEMU
164-
return self.domains[-1]
162+
def bestDomainType(self, accelerated=None):
163+
if accelerated is None:
164+
# Picking last in list so we favour KVM/KQEMU over QEMU
165+
return self.domains[-1]
166+
else:
167+
priority = ["kvm", "xen", "kqemu", "qemu"]
168+
if not accelerated:
169+
priority.reverse()
170+
171+
for type in priority:
172+
for d in self.domains:
173+
if d.hypervisor_type == type:
174+
return d
175+
176+
# Fallback, just return last item in list
177+
return self.domains[-1]
178+
165179

166180
class Domain(object):
167181
def __init__(self, hypervisor_type, emulator = None, loader = None, machines = None, node = None):

0 commit comments

Comments
 (0)