From 79b1b57045e86d9845e352c3f2aa0efbab6111a9 Mon Sep 17 00:00:00 2001 From: gcontini <1121667+gcontini@users.noreply.github.com> Date: 周六, 14 3月 2020 10:19:09 +0800 Subject: [PATCH] tests and improvements --- src/library/os/execution_environment.hpp | 21 ++++++++++++++++----- 1 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/library/os/execution_environment.hpp b/src/library/os/execution_environment.hpp index bc503fb..97172e4 100644 --- a/src/library/os/execution_environment.hpp +++ b/src/library/os/execution_environment.hpp @@ -13,6 +13,12 @@ namespace license { namespace os { +/* + * windows bios sometimes reports vm names add execution environment detection from bios +const char *vmVendors[] = { + "VMware", "Microsoft Corporation", "Virtual Machine", "innotek GmbH", "PowerVM", "Bochs", "KVM"}; +*/ + typedef enum { NONE, CONTAINER, VM } VIRTUALIZATION; typedef enum { @@ -32,18 +38,23 @@ class ExecutionEnvironment { private: - std::string sys_vendor; - std::string bios_vendor; - std::string bios_description; - //detect if it's a kind of container technology (docker or lxc) - bool is_container() const; + std::string m_sys_vendor; + std::string m_bios_vendor; + std::string m_bios_description; + public: ExecutionEnvironment(); ~ExecutionEnvironment(){}; VIRTUALIZATION getVirtualization() const; bool is_cloud() const; bool is_docker() const; + // detect if it's a kind of container technology (docker or lxc) + bool is_container() const; CLOUD_PROVIDER getCloudProvider() const; + const std::string& bios_vendor() const { return m_bios_vendor; }; + const std::string& sys_vendor() const { return m_sys_vendor; }; + const std::string& bios_description() const { return m_bios_description; }; + // VIRTUALIZATION_DETAIL getVirtualizationDetail() const; //as reported by the bios }; } // namespace os -- Gitblit v1.9.1