summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Jones <drjones@redhat.com>2015-11-03 14:49:38 -0600
committerAndrew Jones <drjones@redhat.com>2015-11-04 11:19:33 -0600
commit42685451ed0f1c422395a05820ee4328c352808f (patch)
treeb43b92686d5e7e67d478df38a734836f434a7f23 /src
parent51c41a97ecc36dc274d56755993826ede68e2086 (diff)
detect-virt: detect in best-heuristic order
afaict, this will fix a regression caused by commit 75f86906c5. Where we used to report "kvm" before that patch, without this patch, we would only report "qemu". The reason is because cpuid detection must come before dmi detection. Also, both can safely come before other xen heuristics. Untested.
Diffstat (limited to 'src')
-rw-r--r--src/basic/virt.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/basic/virt.c b/src/basic/virt.c
index fb181e5b55..1e10fc755f 100644
--- a/src/basic/virt.c
+++ b/src/basic/virt.c
@@ -267,12 +267,7 @@ int detect_vm(void) {
if (cached_found >= 0)
return cached_found;
- /* Try xen capabilities file first, if not found try
- * high-level hypervisor sysfs file:
- *
- * https://bugs.freedesktop.org/show_bug.cgi?id=77271 */
-
- r = detect_vm_xen();
+ r = detect_vm_cpuid();
if (r < 0)
return r;
if (r != VIRTUALIZATION_NONE)
@@ -284,7 +279,14 @@ int detect_vm(void) {
if (r != VIRTUALIZATION_NONE)
goto finish;
- r = detect_vm_cpuid();
+ /* x86 xen will most likely be detected by cpuid. If not (most likely
+ * because we're not an x86 guest), then we should try the xen capabilities
+ * file next. If that's not found, then we check for the high-level
+ * hypervisor sysfs file:
+ *
+ * https://bugs.freedesktop.org/show_bug.cgi?id=77271 */
+
+ r = detect_vm_xen();
if (r < 0)
return r;
if (r != VIRTUALIZATION_NONE)