From 2f09010ac0f5c38ebc4ef351695fbcbd3599d14d Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Sun, 20 Jan 2019 17:53:33 +0000 Subject: Add a DMI-based check for QEMU vs KVM. This enabled KVM detection on non-x86 machines. --- src/hypervisor_check.adb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/hypervisor_check.adb') diff --git a/src/hypervisor_check.adb b/src/hypervisor_check.adb index e598169..23a418f 100644 --- a/src/hypervisor_check.adb +++ b/src/hypervisor_check.adb @@ -188,6 +188,24 @@ package body Hypervisor_Check is return Name; end Get_DMI_Vendor_String; + function Get_DMI_Product_Name return US.Unbounded_String is + Product_Name, Vendor_Name : US.Unbounded_String; + begin + if Config.Linux then + Product_Name := Head_Of_File (Linux_Sys_Product_File); + else + raise OS_Not_Supported; + end if; + + if Contains (Product_Name, KVM_DMI_Pattern) then + Vendor_Name := US.To_Unbounded_String (KVM); + else + Vendor_Name := US.Null_Unbounded_String; + end if; + + return Vendor_Name; + end Get_DMI_Product_Name; + function Get_DMI_Vendor_Name (Vendor_String : US.Unbounded_String) return US.Unbounded_String is Vendor_Name : US.Unbounded_String; begin -- cgit v1.2.3