summaryrefslogtreecommitdiff
path: root/src/basic/virt.c
diff options
context:
space:
mode:
authorAndrew Jones <drjones@redhat.com>2015-11-03 13:31:03 -0600
committerAndrew Jones <drjones@redhat.com>2015-11-04 11:19:40 -0600
commit3728dcde4542b7b2792d9ef0baeb742d82983b03 (patch)
tree8892954dcf94549c21be7ef63ff3fa308673a8c8 /src/basic/virt.c
parent2ef8a4c4399dcb7b6fcaecd41f27377b584e9a4b (diff)
downloadsystemd-3728dcde4542b7b2792d9ef0baeb742d82983b03.tar.gz
detect-virt: dmi: look for KVM
Some guests (ARM, AArch64, x86-RHEL) have 'KVM' in the product name. Look for that first in order to more precisely report "kvm" when detecting a QEMU/KVM guest. Without this patch we report "qemu", even if KVM acceleration is in use on ARM/AArch64 guests. I've only tested a backported version of this and the previous patch on an AArch64 guest (which worked). Of course it would be nice to get regression testing on all guest types that depend on dmi done.
Diffstat (limited to 'src/basic/virt.c')
-rw-r--r--src/basic/virt.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/basic/virt.c b/src/basic/virt.c
index 42c54735d8..a211ea1f86 100644
--- a/src/basic/virt.c
+++ b/src/basic/virt.c
@@ -147,6 +147,7 @@ static int detect_vm_dmi(void) {
#if defined(__i386__) || defined(__x86_64__) || defined(__arm__) || defined(__aarch64__)
static const char *const dmi_vendors[] = {
+ "/sys/class/dmi/id/product_name", /* Test this before sys_vendor to detect KVM over QEMU */
"/sys/class/dmi/id/sys_vendor",
"/sys/class/dmi/id/board_vendor",
"/sys/class/dmi/id/bios_vendor"
@@ -156,6 +157,7 @@ static int detect_vm_dmi(void) {
const char *vendor;
int id;
} dmi_vendor_table[] = {
+ { "KVM", VIRTUALIZATION_KVM },
{ "QEMU", VIRTUALIZATION_QEMU },
/* http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1009458 */
{ "VMware", VIRTUALIZATION_VMWARE },