Skip to content

Commit 9f52d08

Browse files
authored
Merge pull request #18 from MagnusS/fix-kvm
Various fixes
2 parents e57b1d9 + ac27cc4 commit 9f52d08

File tree

9 files changed

+16
-3
lines changed

9 files changed

+16
-3
lines changed

scripts/boot renamed to bin/boot

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

conanfile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class VmrunnerConan(ConanFile):
2020

2121
def package(self):
2222
self.copy("*", dst="vmrunner", src="vmrunner")
23-
self.copy("*", dst="bin", src="scripts")
23+
self.copy("*", dst="bin", src="bin")
2424

2525
def package_info(self):
2626
self.env_info.PYTHONPATH.append(self.package_folder)

vmrunner/vmrunner.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -583,11 +583,24 @@ def boot(self, multiboot, debug = False, kernel_args = "", image_name = None):
583583

584584
# TODO: sudo is only required for tap networking and kvm. Check for those.
585585
command = ["sudo", qemu_binary]
586-
if self._kvm_present: command.extend(["--enable-kvm"])
586+
if self._kvm_present:
587+
command.extend(["--enable-kvm"])
587588

588589
# If hvf is present, use it and enable cpu features (needed for rdrand/rdseed)
589590
if self.hvf_present():
590-
command.extend(["-accel","hvf","-cpu","host"])
591+
command.extend(["-accel","hvf"])
592+
593+
# Set -cpu correctly if not specified in config
594+
if not "cpu" in self._config:
595+
if self._kvm_present:
596+
command.extend(["-cpu","kvm64,+rdrand,+rdseed"])
597+
if self.hvf_present():
598+
command.extend(["-cpu","host"])
599+
600+
# Warn if no hardware acceleration
601+
if not (self.hvf_present() or self._kvm_present):
602+
print(color.WARNING("Hardware acceleration not detected. Will attempt to boot anyway.") )
603+
time.sleep(1)
591604

592605
command += kernel_args
593606
command += disk_args + debug_args + net_args + mem_arg + mod_args

0 commit comments

Comments
 (0)