[elbe-devel] [PATCH 02/11] elbepack: init: properly test for /dev/kvm usability

Thomas Weißschuh thomas.weissschuh at linutronix.de
Thu Aug 8 11:38:13 CEST 2024


/dev/kvm may be present but inaccessible.
Fix the test to account for that case.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
 elbepack/init/Makefile.mako | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/elbepack/init/Makefile.mako b/elbepack/init/Makefile.mako
index d3f0dc929ac4..dc6abc7029b6 100644
--- a/elbepack/init/Makefile.mako
+++ b/elbepack/init/Makefile.mako
@@ -11,7 +11,7 @@ from elbepack.filesystem import size_to_int
 max_cpus = int(prj.text('max-cpus', default=defs, key='max-cpus'))
 memory = size_to_int(prj.text('mem', default=defs, key='mem')) // 1024 // 1024
 interpreter = prj.text('interpreter', default=defs, key='interpreter')
-use_kvm = os.path.exists('/dev/kvm') and b'kvm' in subprocess.check_output([interpreter, '-accel', 'help'])
+use_kvm = os.access('/dev/kvm', os.R_OK | os.W_OK) and b'kvm' in subprocess.check_output([interpreter, '-accel', 'help'])
 %>
 
 MEMSIZE?=${memory}

-- 
2.46.0



More information about the elbe-devel mailing list