virt: Fix the detection for Hyper-V VMs

This commit is contained in:
Andrew Lukoshko 2022-11-18 16:57:42 +00:00
parent bb74c072e5
commit 32d7d2633f
3 changed files with 36 additions and 25 deletions

View File

@ -0,0 +1,34 @@
From 4d5869f90a260329558e5ff157e56d7b918b5d08 Mon Sep 17 00:00:00 2001
From: Andrew Lukoshko <andrew.lukoshko@gmail.com>
Date: Fri, 18 Nov 2022 16:47:34 +0000
Subject: [PATCH] virt: Fix the detection for Hyper-V VMs
---
src/basic/virt.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/basic/virt.c b/src/basic/virt.c
index d347732..390d0c5 100644
--- a/src/basic/virt.c
+++ b/src/basic/virt.c
@@ -131,7 +131,8 @@ static int detect_vm_dmi(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 {
@@ -149,6 +150,7 @@ static int detect_vm_dmi(void) {
{ "Parallels", VIRTUALIZATION_PARALLELS },
/* https://wiki.freebsd.org/bhyve */
{ "BHYVE", VIRTUALIZATION_BHYVE },
+ { "Hyper-V", VIRTUALIZATION_MICROSOFT },
};
unsigned i;
int r;
--
2.27.0

View File

@ -1,24 +0,0 @@
From 1411ffd6a63af4e71e9cf842727f0421d7ee92e6 Mon Sep 17 00:00:00 2001
From: Andrew Lukoshko <andrew.lukoshko@gmail.com>
Date: Wed, 1 Dec 2021 13:29:56 +0000
Subject: [PATCH] virt: Support detection for ARM64 Hyper-V guests
---
src/basic/virt.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/basic/virt.c b/src/basic/virt.c
index 0b88005..5abba75 100644
--- a/src/basic/virt.c
+++ b/src/basic/virt.c
@@ -155,6 +155,7 @@ static int detect_vm_dmi(void) {
{ "Parallels", VIRTUALIZATION_PARALLELS },
/* https://wiki.freebsd.org/bhyve */
{ "BHYVE", VIRTUALIZATION_BHYVE },
+ { "Microsoft", VIRTUALIZATION_MICROSOFT },
};
unsigned i;
int r;
--
2.27.0

View File

@ -884,7 +884,8 @@ Patch0831: 0831-logind-schedule-idle-check-full-interval-from-now-if.patch
# https://github.com/systemd/systemd/pull/20998
Patch1000: 1000-virt-Support-detection-for-ARM64-Hyper-V-guests.patch
# https://github.com/systemd/systemd/pull/21475
Patch1000: 1000-virt-Fix-the-detection-for-Hyper-V-VMs.patch
%ifarch %{ix86} x86_64 aarch64
%global have_gnu_efi 1