]> Git Repo - qemu.git/commitdiff
tests/vm: Extract the kvm_available() handy function
authorPhilippe Mathieu-Daudé <[email protected]>
Sat, 13 Oct 2018 00:40:26 +0000 (02:40 +0200)
committerFam Zheng <[email protected]>
Fri, 26 Oct 2018 14:03:21 +0000 (22:03 +0800)
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <20181013004034[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Signed-off-by: Fam Zheng <[email protected]>
scripts/qemu.py
tests/vm/basevm.py

index f099ce72782f2dc7ba636a05be5385ad78a85a0a..9fc0be48283f3d296494555205ec7f2bb6d6b433 100644 (file)
@@ -26,6 +26,10 @@ import tempfile
 LOG = logging.getLogger(__name__)
 
 
+def kvm_available(target_arch=None):
+    return os.access("/dev/kvm", os.R_OK | os.W_OK)
+
+
 #: Maps machine types to the preferred console device types
 CONSOLE_DEV_TYPES = {
     r'^clipper$': 'isa-serial',
index cafbc6b3a585dec47332264bbad322d3aa42e123..834bc90cc1fe0dd35f5a240b126271fe996aa585 100755 (executable)
@@ -18,7 +18,7 @@ import logging
 import time
 import datetime
 sys.path.append(os.path.join(os.path.dirname(__file__), "..", "..", "scripts"))
-from qemu import QEMUMachine
+from qemu import QEMUMachine, kvm_available
 import subprocess
 import hashlib
 import optparse
@@ -72,7 +72,7 @@ class BaseVM(object):
             "-serial", "file:%s" % os.path.join(self._tmpdir, "serial.out")]
         if vcpus:
             self._args += ["-smp", str(vcpus)]
-        if os.access("/dev/kvm", os.R_OK | os.W_OK):
+        if kvm_available():
             self._args += ["-enable-kvm"]
         else:
             logging.info("KVM not available, not using -enable-kvm")
This page took 0.027132 seconds and 4 git commands to generate.