class Beaker::Hypervisor
The Beaker class that interacts to all the supported hypervisors
def self.create(type, hosts_to_provision, options)
-
options
(Hash
) -- options Options to alter execution -
hosts_to_provision
(Array
) -- The hosts to be provisioned with the selected hypervisor -
type
(String
) -- The type of hypervisor to create - one of aix, solaris, vsphere, fusion,
def self.create(type, hosts_to_provision, options) @logger = options[:logger] @logger.notify("Beaker::Hypervisor, found some #{type} boxes to create") hyper_class = case type when /^aix$/ Beaker::Aixer when /^solaris$/ Beaker::Solaris when /^vsphere$/ Beaker::Vsphere when /^fusion$/ Beaker::Fusion when /^ec2$/ Beaker::AwsSdk when /^vmpooler$/ Beaker::Vmpooler when /^vcloud$/ if options['pooling_api'] Beaker::Vmpooler else Beaker::Vcloud end when /^vagrant$/ Beaker::Vagrant when /^vagrant_libvirt$/ Beaker::VagrantLibvirt when /^vagrant_virtualbox$/ Beaker::VagrantVirtualbox when /^vagrant_fusion$/ Beaker::VagrantFusion when /^vagrant_workstation$/ Beaker::VagrantWorkstation when /^vagrant_parallels$/ Beaker::VagrantParallels when /^google$/ Beaker::GoogleCompute when /^docker$/ Beaker::Docker when /^openstack$/ Beaker::OpenStack when /^none$/ Beaker::Hypervisor else # Custom hypervisor begin require "beaker/hypervisor/#{type}" rescue LoadError raise "Invalid hypervisor: #{type}" end Beaker.const_get(type.capitalize) end hypervisor = hyper_class.new(hosts_to_provision, options) hypervisor.provision hypervisor end
def cleanup
def cleanup nil end
def configure
Default configuration steps to be run for a given hypervisor. Any additional configuration to be done
def configure return unless @options[:configure] if @options[:timesync] timesync(@hosts, @options) end if @options[:root_keys] sync_root_keys(@hosts, @options) end if @options[:add_el_extras] add_el_extras(@hosts, @options) end if @options[:disable_iptables] disable_iptables @hosts, @options end if @options[:set_env] set_env(@hosts, @options) end end
def generate_host_name
def generate_host_name CHARMAP[rand(25)] + (0...14).map{CHARMAP[rand(CHARMAP.length)]}.join end
def initialize(hosts, options)
def initialize(hosts, options) @hosts = hosts @options = options end
def provision
def provision nil end
def proxy_package_manager
def proxy_package_manager if @options[:package_proxy] package_proxy(@hosts, @options) end end
def validate
Default validation steps to be run for a given hypervisor. Ensures that SUTs meet requirements to be
def validate if @options[:validate] validate_host(@hosts, @options) end end