From 4467a957a498b93dbcaefbad97df24b43dfbc99d Mon Sep 17 00:00:00 2001 From: gcontini <1121667+gcontini@users.noreply.github.com> Date: 周日, 08 3月 2020 22:16:09 +0800 Subject: [PATCH] fix tests --- src/library/os/execution_environment.hpp | 31 +++++++++++++++++++++++++------ 1 files changed, 25 insertions(+), 6 deletions(-) diff --git a/src/library/os/execution_environment.hpp b/src/library/os/execution_environment.hpp index 1c15ab4..db36205 100644 --- a/src/library/os/execution_environment.hpp +++ b/src/library/os/execution_environment.hpp @@ -8,10 +8,21 @@ #ifndef SRC_LIBRARY_OS_VIRTUALIZATION_HPP_ #define SRC_LIBRARY_OS_VIRTUALIZATION_HPP_ +#include <string> + 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 { + PROV_UNKNOWN, ON_PREMISE, GOOGLE_CLOUD, AZURE_CLOUD, @@ -26,14 +37,22 @@ } CLOUD_PROVIDER; 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; + public: - ExecutionEnvironment(){}; - virtual ~ExecutionEnvironment(){}; - VIRTUALIZATION getVirtualization(); - bool is_cloud(); - bool is_docker(); - CLOUD_PROVIDER getCloudProvider(); + ExecutionEnvironment(); + ~ExecutionEnvironment(){}; + VIRTUALIZATION getVirtualization() const; + bool is_cloud() const; + bool is_docker() const; + CLOUD_PROVIDER getCloudProvider() const; }; + } // namespace os } // namespace license -- Gitblit v1.9.1