mirror of
https://github.com/systemd/systemd.git
synced 2026-07-19 22:10:56 +00:00
virt: Fix the detection for Hyper-V VMs
Use product_version instead of product_name in DMI table and the string "Hyper-V" to avoid misdetection. Fixes: #21468 Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
This commit is contained in:
committed by
Lennart Poettering
parent
244cab4a65
commit
76eec06499
@@ -146,7 +146,8 @@ static int detect_vm_dmi_vendor(void) {
|
||||
"/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"
|
||||
"/sys/class/dmi/id/bios_vendor",
|
||||
"/sys/class/dmi/id/product_version" /* For Hyper-V VMs test */
|
||||
};
|
||||
|
||||
static const struct {
|
||||
@@ -165,7 +166,7 @@ static int detect_vm_dmi_vendor(void) {
|
||||
{ "Parallels", VIRTUALIZATION_PARALLELS },
|
||||
/* https://wiki.freebsd.org/bhyve */
|
||||
{ "BHYVE", VIRTUALIZATION_BHYVE },
|
||||
{ "Microsoft", VIRTUALIZATION_MICROSOFT },
|
||||
{ "Hyper-V", VIRTUALIZATION_MICROSOFT },
|
||||
};
|
||||
int r;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user