summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-07-23 21:38:01 +0200
committerLennart Poettering <lennart@poettering.net>2015-07-23 21:38:01 +0200
commitc5f44880ca35bc0246ddf90cbf2af45b10e4a4d5 (patch)
tree3290ead1201c63e59ecb4540df4515814b24626e /src
parentbd5ecd55c8fa3a60c452d6852cc5e65012de7e73 (diff)
parente32886e0105d30799309ab2705addbee0d33b4da (diff)
Merge pull request #678 from eworm-de/oracle-kvm
Oracle kvm
Diffstat (limited to 'src')
-rw-r--r--src/basic/virt.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/basic/virt.c b/src/basic/virt.c
index 1299a75ed5..a8d26716a1 100644
--- a/src/basic/virt.c
+++ b/src/basic/virt.c
@@ -188,7 +188,7 @@ int detect_vm(const char **id) {
_cleanup_free_ char *domcap = NULL, *cpuinfo_contents = NULL;
static thread_local int cached_found = -1;
static thread_local const char *cached_id = NULL;
- const char *_id = NULL;
+ const char *_id = NULL, *_id_cpuid = NULL;
int r;
if (_likely_(cached_found >= 0)) {
@@ -234,10 +234,26 @@ int detect_vm(const char **id) {
/* this will set _id to "other" and return 0 for unknown hypervisors */
r = detect_vm_cpuid(&_id);
- if (r != 0)
+
+ /* finish when found a known hypervisor other than kvm */
+ if (r < 0 || (r > 0 && !streq(_id, "kvm")))
goto finish;
+ _id_cpuid = _id;
+
r = detect_vm_dmi(&_id);
+
+ /* kvm with and without Virtualbox */
+ if (streq_ptr(_id_cpuid, "kvm")) {
+ if (r > 0 && streq(_id, "oracle"))
+ goto finish;
+
+ _id = _id_cpuid;
+ r = 1;
+ goto finish;
+ }
+
+ /* information from dmi */
if (r != 0)
goto finish;