chiark / gitweb /
virt: detect dmi before cpuid
authorChristian Hesse <mail@eworm.de>
Mon, 23 Nov 2015 12:55:04 +0000 (13:55 +0100)
committerSven Eden <yamakuzure@gmx.net>
Wed, 17 May 2017 13:22:14 +0000 (15:22 +0200)
Virtualbox should be detected as 'oracle'. This used to work but broke
with commit:

    commit 75f86906c52735c98dc0aa7e24b773edb42ee814
    Author: Lennart Poettering <lennart@poettering.net>
    Date:   Mon Sep 7 13:42:47 2015 +0200

    basic: rework virtualization detection API

We swap detection for dmi and cpuid, this fixes Virtualbox with KVM.
Hopefully it does not break anything else.

src/basic/virt.c

index 4b6286567899fc2376ba8a30d30a91f742ea7480..a3811054284e242e4d06d675f9c5258e39b0ea02 100644 (file)
@@ -270,13 +270,13 @@ int detect_vm(void) {
         if (cached_found >= 0)
                 return cached_found;
 
-        r = detect_vm_cpuid();
+        r = detect_vm_dmi();
         if (r < 0)
                 return r;
         if (r != VIRTUALIZATION_NONE)
                 goto finish;
 
-        r = detect_vm_dmi();
+        r = detect_vm_cpuid();
         if (r < 0)
                 return r;
         if (r != VIRTUALIZATION_NONE)