|
|
b11b5f |
From e732bc987f2f779e89f30193bf694e0456ab7ce0 Mon Sep 17 00:00:00 2001
|
|
|
b11b5f |
From: Boqun Feng <boqun.feng@gmail.com>
|
|
|
b11b5f |
Date: Tue, 23 Nov 2021 15:09:26 +0800
|
|
|
b11b5f |
Subject: [PATCH] virt: Fix the detection for Hyper-V VMs
|
|
|
b11b5f |
|
|
|
b11b5f |
Use product_version instead of product_name in DMI table and the string
|
|
|
b11b5f |
"Hyper-V" to avoid misdetection.
|
|
|
b11b5f |
|
|
|
b11b5f |
Fixes: #21468
|
|
|
b11b5f |
|
|
|
b11b5f |
Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
|
|
|
b11b5f |
(cherry picked from commit 76eec0649936d9ae2f9087769f463feaf0cf5cb4)
|
|
|
b11b5f |
|
|
|
b11b5f |
Related: #2158307
|
|
|
b11b5f |
---
|
|
|
b11b5f |
src/basic/virt.c | 5 +++--
|
|
|
b11b5f |
1 file changed, 3 insertions(+), 2 deletions(-)
|
|
|
b11b5f |
|
|
|
b11b5f |
diff --git a/src/basic/virt.c b/src/basic/virt.c
|
|
|
b11b5f |
index cc95097101..f750a0463f 100644
|
|
|
b11b5f |
--- a/src/basic/virt.c
|
|
|
b11b5f |
+++ b/src/basic/virt.c
|
|
|
b11b5f |
@@ -143,7 +143,8 @@ static int detect_vm_dmi_vendor(void) {
|
|
|
b11b5f |
"/sys/class/dmi/id/product_name", /* Test this before sys_vendor to detect KVM over QEMU */
|
|
|
b11b5f |
"/sys/class/dmi/id/sys_vendor",
|
|
|
b11b5f |
"/sys/class/dmi/id/board_vendor",
|
|
|
b11b5f |
- "/sys/class/dmi/id/bios_vendor"
|
|
|
b11b5f |
+ "/sys/class/dmi/id/bios_vendor",
|
|
|
b11b5f |
+ "/sys/class/dmi/id/product_version" /* For Hyper-V VMs test */
|
|
|
b11b5f |
};
|
|
|
b11b5f |
|
|
|
b11b5f |
static const struct {
|
|
|
b11b5f |
@@ -162,7 +163,7 @@ static int detect_vm_dmi_vendor(void) {
|
|
|
b11b5f |
{ "Parallels", VIRTUALIZATION_PARALLELS },
|
|
|
b11b5f |
/* https://wiki.freebsd.org/bhyve */
|
|
|
b11b5f |
{ "BHYVE", VIRTUALIZATION_BHYVE },
|
|
|
b11b5f |
- { "Microsoft", VIRTUALIZATION_MICROSOFT },
|
|
|
b11b5f |
+ { "Hyper-V", VIRTUALIZATION_MICROSOFT },
|
|
|
b11b5f |
};
|
|
|
b11b5f |
unsigned i;
|
|
|
b11b5f |
int r;
|