]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
cpu-gather: Move qemu detection to new script
authorTim Wiederhake <twiederh@redhat.com>
Tue, 15 Dec 2020 16:24:54 +0000 (17:24 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 18 Dec 2020 22:19:59 +0000 (23:19 +0100)
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
tests/cputestdata/cpu-gather.py
tests/cputestdata/cpu-gather.sh

index db2348b460ae4b983ee117fffcb15402df8d6c88..7f9479f78d30c1455cd39f994fd36ff5fcac5aaa 100755 (executable)
@@ -77,9 +77,25 @@ def main():
         metavar="PATH",
         help="Path to 'cpuid' utility. "
         "If unset, the first executable 'cpuid' in $PATH is used.")
+    parser.add_argument(
+        "--path-to-qemu",
+        metavar="PATH",
+        help="Path to qemu. "
+        "If unset, will try '/usr/bin/qemu-system-x86_64', "
+        "'/usr/bin/qemu-kvm', and '/usr/libexec/qemu-kvm'.")
 
     args = parser.parse_args()
 
+    if not args.path_to_qemu:
+        args.path_to_qemu = "qemu-system-x86_64"
+        search = [
+            "/usr/bin/qemu-system-x86_64",
+            "/usr/bin/qemu-kvm",
+            "/usr/libexec/qemu-kvm"]
+        for f in search:
+            if os.path.isfile(f):
+                args.path_to_qemu = f
+
     name = gather_name(args)
     print("model name\t: {}".format(name))
 
@@ -97,6 +113,7 @@ def main():
 
     print(end="", flush=True)
     os.environ["CPU_GATHER_PY"] = "true"
+    os.environ["qemu"] = args.path_to_qemu
     subprocess.check_call("./cpu-gather.sh")
 
 
index 427b81a64b1d49a5deda520d37c4510d8f6eb27f..4b4ac1a47c00dbe90083d6bad0490fb3570b273b 100755 (executable)
@@ -5,14 +5,6 @@ if [ -z "${CPU_GATHER_PY}" ]; then
     exit 1
 fi
 
-qemu=qemu-system-x86_64
-for cmd in /usr/bin/$qemu /usr/bin/qemu-kvm /usr/libexec/qemu-kvm; do
-    if [[ -x $cmd ]]; then
-        qemu=$cmd
-        break
-    fi
-done
-
 qom_get()
 {
     path='/machine/unattached/device[0]'