summaryrefslogtreecommitdiff
path: root/src/hypervisor_check.adb
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@baturin.org>2019-01-20 17:53:33 +0000
committerDaniil Baturin <daniil@baturin.org>2019-01-20 17:53:33 +0000
commit2f09010ac0f5c38ebc4ef351695fbcbd3599d14d (patch)
tree92fc9539e84d2a87b78677a5e34ac5cbe3ffa2ee /src/hypervisor_check.adb
parent0801a54b6c5d95ce6e18d6bbd525c66b9d7a6bdf (diff)
downloadhvinfo-2f09010ac0f5c38ebc4ef351695fbcbd3599d14d.tar.gz
hvinfo-2f09010ac0f5c38ebc4ef351695fbcbd3599d14d.zip
Add a DMI-based check for QEMU vs KVM.
This enabled KVM detection on non-x86 machines.
Diffstat (limited to 'src/hypervisor_check.adb')
-rw-r--r--src/hypervisor_check.adb18
1 files changed, 18 insertions, 0 deletions
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