class BeakerHostGenerator::Hypervisor::Interface

Public Class Methods

new(name) click to toggle source
# File lib/beaker-hostgenerator/hypervisor.rb, line 53
def initialize(name)
  @name = name
end

Public Instance Methods

generate_node(node_info, base_config, bhg_version) click to toggle source

Returns a map of host configuration for a single node.

This will be called for each individual node requested in the hosts specification input.

Any configuration that is required by this hypervisor but is not specific to each node can be put in the `global_config` map.

@param [Hash{String=>String}] node_info General info about the given

node, such as the ostype, nodeid, and
bits.

@param [Hash{String=>Object}] base_config The node definition so far,

which serves a starting point for this
hypervisor to build upon. It is expected
that this map will be merged into the map
returned by this method.

@param [Integer] bhg_version The version of OS info to use when building

up the node definition.
# File lib/beaker-hostgenerator/hypervisor.rb, line 88
def generate_node(node_info, base_config, bhg_version)
  raise "Method 'generate_node' not implemented!"
end
global_config() click to toggle source

Returns a map containing any general configuration required by this hypervisor. This map will be merged into the 'CONFIG' section of the final hosts configuration output.

This will only be called if the hypervisor is used for a node, in which case the returned map will be merged in with global configuration from other hypervisors.

# File lib/beaker-hostgenerator/hypervisor.rb, line 64
def global_config()
  {}
end

Private Instance Methods

base_generate_node(node_info, base_config, bhg_version, *hypervisors) click to toggle source
# File lib/beaker-hostgenerator/hypervisor.rb, line 94
def base_generate_node(node_info, base_config, bhg_version, *hypervisors)
  platform = node_info['platform']
  hypervisors.map do |hypervisor|
    base_config.deeper_merge! get_platform_info(bhg_version, platform, hypervisor)
  end

  base_config['hypervisor'] = @name

  return base_config
end