[elbe-devel] [PATCH] elbe: kvm: added qemu-system-x86_64 as kvm executable
Kurt Kanzenbach
kurt at linutronix.de
Wed Mar 22 11:50:15 CET 2017
KVM has been merged into QEMU. The official way to use KVM these days is to use
'qemu-system-x86_64' with the '-enable-kvm' option. Thus, not all distributions
provide KVM wrappers. If there's no KVM wrapper script found, the Makefile
generation for the Init VM fails with an cryptic error message:
Traceback (most recent call last):
File "/home/kurt/git/elbe/elbepack/templates.py", line 35, in template
return Template(filename=fname,preprocessor=fix_linebreak_escapes).render(**d)
File "/usr/lib/python2.7/dist-packages/mako/template.py", line 443, in render
return runtime._render(self, self.callable_, args, data)
File "/usr/lib/python2.7/dist-packages/mako/runtime.py", line 803, in _render
**_kwargs_for_callable(callable_, data))
File "/usr/lib/python2.7/dist-packages/mako/runtime.py", line 835, in _render_context
_exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
File "/usr/lib/python2.7/dist-packages/mako/runtime.py", line 860, in _exec_template
callable_(context, *args, **kwargs)
File "/home/kurt/git/elbe/elbepack/init/Makefile.mako", line 30, in render_body
<%
ValueError: invalid literal for int() with base 10: 'v'
Thus, add qemu-system-x86_64 as KVM executable. If so, we need to make sure
that -enable-kvm is passed as option.
While here, removed unused code.
Signed-off-by: Kurt Kanzenbach <kurt at linutronix.de>
---
elbepack/kvm.py | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/elbepack/kvm.py b/elbepack/kvm.py
index c958cbe..2f2288a 100644
--- a/elbepack/kvm.py
+++ b/elbepack/kvm.py
@@ -19,14 +19,11 @@
import os
import subprocess
-class NoExecutableFound (Exception):
- def __init__ (self, exe_fname):
- Exception.__init__ (self, 'No Executable for "%s" found')
-
kvm_exe_list = [
'/usr/bin/kvm',
'/usr/bin/qemu-kvm',
- '/usr/libexec/qemu-kvm'
+ '/usr/libexec/qemu-kvm',
+ '/usr/bin/qemu-system-x86_64'
]
def find_kvm_exe ():
@@ -38,6 +35,9 @@ def find_kvm_exe ():
if "version" in line:
version = line.split()[3].split('(')[0].strip()
+ if fname == "/usr/bin/qemu-system-x86_64":
+ fname += " -enable-kvm"
+
return fname, version
return 'kvm_executable_not_found'
--
2.1.4
More information about the elbe-devel
mailing list