X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fbasic%2Fvirt.c;h=6eb1d0c46e41730f3f1015ed286c4313e2149a7b;hb=bc983c987eb3f92eceb373ba4e1c2076b0b3ca88;hp=a3811054284e242e4d06d675f9c5258e39b0ea02;hpb=7f3a80e5c0dd402adf7e0a2cd58313ae1ddb86b2;p=elogind.git diff --git a/src/basic/virt.c b/src/basic/virt.c index a38110542..6eb1d0c46 100644 --- a/src/basic/virt.c +++ b/src/basic/virt.c @@ -1,5 +1,3 @@ -/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ - /*** This file is part of systemd. @@ -20,6 +18,8 @@ ***/ #include +#include +#include #include #include @@ -27,11 +27,11 @@ #include "dirent-util.h" #include "fd-util.h" #include "fileio.h" +#include "macro.h" #include "process-util.h" #include "stat-util.h" #include "string-table.h" #include "string-util.h" -#include "util.h" #include "virt.h" #if 0 /// UNNEEDED by elogind @@ -270,6 +270,13 @@ int detect_vm(void) { if (cached_found >= 0) return cached_found; + /* We have to use the correct order here: + * Some virtualization technologies do use KVM hypervisor but are + * expected to be detected as something else. So detect DMI first. + * + * An example is Virtualbox since version 5.0, which uses KVM backend. + * Detection via DMI works corretly, the CPU ID would find KVM + * only. */ r = detect_vm_dmi(); if (r < 0) return r;