[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 1/8] tests/vm: Extract the kvm_available() handy
From: |
Philippe Mathieu-Daudé |
Subject: |
[Qemu-devel] [PATCH v3 1/8] tests/vm: Extract the kvm_available() handy function |
Date: |
Sat, 13 Oct 2018 02:40:26 +0200 |
Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
scripts/qemu.py | 4 ++++
tests/vm/basevm.py | 4 ++--
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/scripts/qemu.py b/scripts/qemu.py
index f099ce7278..9fc0be4828 100644
--- a/scripts/qemu.py
+++ b/scripts/qemu.py
@@ -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',
diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py
index cafbc6b3a5..834bc90cc1 100755
--- a/tests/vm/basevm.py
+++ b/tests/vm/basevm.py
@@ -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")
--
2.19.1
- [Qemu-devel] [PATCH v3 0/8] tests/vm: Improvements when KVM is not available, Philippe Mathieu-Daudé, 2018/10/12
- [Qemu-devel] [PATCH v3 1/8] tests/vm: Extract the kvm_available() handy function,
Philippe Mathieu-Daudé <=
- [Qemu-devel] [PATCH v3 2/8] tests/vm: Do not abuse parallelism when KVM is not available, Philippe Mathieu-Daudé, 2018/10/12
- [Qemu-devel] [PATCH v3 5/8] tests/vm: Add a BaseVM::arch property, Philippe Mathieu-Daudé, 2018/10/12
- [Qemu-devel] [PATCH v3 3/8] tests/vm: Do not use the -smp option with a single cpu, Philippe Mathieu-Daudé, 2018/10/12
- [Qemu-devel] [PATCH v3 4/8] tests/vm: Display remaining seconds to wait for a VM to start, Philippe Mathieu-Daudé, 2018/10/12
- [Qemu-devel] [PATCH v3 6/8] tests/vm: Let kvm_available() work in cross environments, Philippe Mathieu-Daudé, 2018/10/12
- [Qemu-devel] [PATCH v3 7/8] tests/vm: Do not use -enable-kvm if HOST != TARGET architecture, Philippe Mathieu-Daudé, 2018/10/12
- [Qemu-devel] [PATCH v3 8/8] tests/vm: Do not abuse parallelism when HOST != TARGET architecture, Philippe Mathieu-Daudé, 2018/10/12
- Re: [Qemu-devel] [PATCH v3 0/8] tests/vm: Improvements when KVM is not available, Richard Henderson, 2018/10/15
- Re: [Qemu-devel] [PATCH v3 0/8] tests/vm: Improvements when KVM is not available, Fam Zheng, 2018/10/22