Skip to content

Commit

Permalink
Merge pull request #18 from MagnusS/fix-kvm
Browse files Browse the repository at this point in the history
Various fixes
  • Loading branch information
mnordsletten authored Apr 10, 2019
2 parents e57b1d9 + ac27cc4 commit 9f52d08
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 3 deletions.
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.
2 changes: 1 addition & 1 deletion conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class VmrunnerConan(ConanFile):

def package(self):
self.copy("*", dst="vmrunner", src="vmrunner")
self.copy("*", dst="bin", src="scripts")
self.copy("*", dst="bin", src="bin")

def package_info(self):
self.env_info.PYTHONPATH.append(self.package_folder)
Expand Down
17 changes: 15 additions & 2 deletions vmrunner/vmrunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -583,11 +583,24 @@ def boot(self, multiboot, debug = False, kernel_args = "", image_name = None):

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

# If hvf is present, use it and enable cpu features (needed for rdrand/rdseed)
if self.hvf_present():
command.extend(["-accel","hvf","-cpu","host"])
command.extend(["-accel","hvf"])

# Set -cpu correctly if not specified in config
if not "cpu" in self._config:
if self._kvm_present:
command.extend(["-cpu","kvm64,+rdrand,+rdseed"])
if self.hvf_present():
command.extend(["-cpu","host"])

# Warn if no hardware acceleration
if not (self.hvf_present() or self._kvm_present):
print(color.WARNING("Hardware acceleration not detected. Will attempt to boot anyway.") )
time.sleep(1)

command += kernel_args
command += disk_args + debug_args + net_args + mem_arg + mod_args
Expand Down

0 comments on commit 9f52d08

Please sign in to comment.