Sha256: 908314baabefa44b861f9f419d63a64e245990f27d4dce0094c598566c75d8cb

Contents?: true

Size: 1.42 KB

Versions: 16

Compression:

Stored size: 1.42 KB

Contents

#include <internal/facts/solaris/virtualization_resolver.hpp>
#include <facter/facts/vm.hpp>
#include <facter/facts/scalar_value.hpp>
#include <facter/facts/collection.hpp>
#include <facter/facts/fact.hpp>
#include <leatherman/execution/execution.hpp>
#include <leatherman/logging/logging.hpp>
#include <boost/algorithm/string.hpp>
#include <map>

using namespace std;
using namespace facter::facts;
using namespace leatherman::execution;

namespace facter { namespace facts { namespace solaris {

    string virtualization_resolver::get_hypervisor(collection& facts)
    {
        // If in an LDom, the LDom facts will resolve and we can use them to identify
        // that we're in a virtual LDom environment. They should only resolve on SPARC.
        auto ldom_domainrole_control = facts.get<string_value>("ldom_domainrole_control");
        if (ldom_domainrole_control && ldom_domainrole_control->value() == "false") {
            auto ldom_domainrole_impl = facts.get<string_value>("ldom_domainrole_impl");
            if (ldom_domainrole_impl) {
                return ldom_domainrole_impl->value();
            }
        }

        // works for both x86 & sparc.
        auto exec = execute("/usr/bin/zonename");
        if (exec.success && exec.output != "global") {
            return vm::zone;
        }

        // Look for hypervisor matches based on other facts
        return get_fact_vm(facts);
    }
}}}  // namespace facter::facts::solaris

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
facter-3.12.2.cfacter.20181217 ext/facter/facter/lib/src/facts/solaris/virtualization_resolver.cc
facter-3.12.1.cfacter.20181031 ext/facter/facter/lib/src/facts/solaris/virtualization_resolver.cc
facter-3.11.6.cfacter.20181031 ext/facter/facter/lib/src/facts/solaris/virtualization_resolver.cc
facter-3.12.1.cfacter.20181023 ext/facter/facter/lib/src/facts/solaris/virtualization_resolver.cc
facter-3.11.5.cfacter.20181022 ext/facter/facter/lib/src/facts/solaris/virtualization_resolver.cc
facter-3.12.0.cfacter.20181004 ext/facter/facter/lib/src/facts/solaris/virtualization_resolver.cc
facter-3.12.0.cfacter.20181001 ext/facter/facter/lib/src/facts/solaris/virtualization_resolver.cc
facter-3.12.0.cfacter.20180918 ext/facter/facter/lib/src/facts/solaris/virtualization_resolver.cc
facter-3.11.4.cfacter.20180821 ext/facter/facter/lib/src/facts/solaris/virtualization_resolver.cc
facter-3.11.3.cfacter.20180716 ext/facter/facter/lib/src/facts/solaris/virtualization_resolver.cc
facter-3.11.2.cfacter.20180612 ext/facter/facter/lib/src/facts/solaris/virtualization_resolver.cc
facter-3.9.6.cfacter.20180612 ext/facter/facter/lib/src/facts/solaris/virtualization_resolver.cc
facter-3.11.2.cfacter.20180606 ext/facter/facter/lib/src/facts/solaris/virtualization_resolver.cc
facter-3.9.6.cfacter.20180606 ext/facter/facter/lib/src/facts/solaris/virtualization_resolver.cc
facter-3.11.0.cfacter.20180319 ext/facter/facter/lib/src/facts/solaris/virtualization_resolver.cc
cfacter-3.11.0.rc.20180314 ext/facter/facter/lib/src/facts/solaris/virtualization_resolver.cc