Class: Beaker::Hypervisor
- Inherits:
-
Object
- Object
- Beaker::Hypervisor
- Includes:
- HostPrebuiltSteps
- Defined in:
- lib/beaker/hypervisor.rb
Overview
The Beaker class that interacts to all the supported hypervisors
Direct Known Subclasses
Aixer, Blimper, Fusion, GoogleCompute, Solaris, Vagrant, Vcloud, VcloudPooled, Vsphere
Constant Summary collapse
- CHARMAP =
Generates an array with all letters a thru z and numbers 0 thru 9
('a'..'z').to_a + ('0'..'9').to_a
Constants included from HostPrebuiltSteps
Beaker::HostPrebuiltSteps::APT_CFG, Beaker::HostPrebuiltSteps::ETC_HOSTS_PATH, Beaker::HostPrebuiltSteps::ETC_HOSTS_PATH_SOLARIS, Beaker::HostPrebuiltSteps::IPS_PKG_REPO, Beaker::HostPrebuiltSteps::NTPSERVER, Beaker::HostPrebuiltSteps::PACKAGES, Beaker::HostPrebuiltSteps::ROOT_KEYS_SCRIPT, Beaker::HostPrebuiltSteps::ROOT_KEYS_SYNC_CMD, Beaker::HostPrebuiltSteps::SLEEPWAIT, Beaker::HostPrebuiltSteps::SLES_PACKAGES, Beaker::HostPrebuiltSteps::TRIES, Beaker::HostPrebuiltSteps::UNIX_PACKAGES
Class Method Summary collapse
-
.create(type, hosts_to_provision, options) ⇒ Object
Hypervisor creator method.
Instance Method Summary collapse
-
#cleanup ⇒ Object
Cleanup steps to be run for a given hypervisor.
-
#configure ⇒ Object
Default configuration steps to be run for a given hypervisor.
-
#generate_host_name ⇒ Object
Generate a random straing composted of letter and numbers.
-
#initialize(hosts, options) ⇒ Hypervisor
constructor
A new instance of Hypervisor.
-
#provision ⇒ Object
Provisioning steps for be run for a given hypervisor.
-
#validate ⇒ Object
Default validation steps to be run for a given hypervisor.
Methods included from HostPrebuiltSteps
#add_el_extras, #add_master_entry, #apt_get_update, #copy_file_to_remote, #copy_ssh_to_root, #disable_iptables, #disable_se_linux, #enable_root_login, #epel_info_for!, #get_domain_name, #get_ip, #hack_etc_hosts, #proxy_config, #set_etc_hosts, #sync_root_keys, #timesync, #validate_host
Constructor Details
#initialize(hosts, options) ⇒ Hypervisor
Returns a new instance of Hypervisor.
59 60 61 62 |
# File 'lib/beaker/hypervisor.rb', line 59 def initialize(hosts, ) @hosts = hosts = end |
Class Method Details
.create(type, hosts_to_provision, options) ⇒ Object
Hypervisor creator method. Creates the appropriate hypervisor class object based upon the provided hypervisor type selected, then provisions hosts with hypervisor.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/beaker/hypervisor.rb', line 23 def self.create(type, hosts_to_provision, ) @logger = [: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 /blimpy/ Beaker::Blimper when /vcloud/ if ['pooling_api'] Beaker::VcloudPooled else Beaker::Vcloud end when /vagrant/ Beaker::Vagrant when /google/ Beaker::GoogleCompute when /none/ Beaker::Hypervisor else raise "Invalid hypervisor: #{type}" end hypervisor = hyper_class.new(hosts_to_provision, ) hypervisor.provision hypervisor end |
Instance Method Details
#cleanup ⇒ Object
Cleanup steps to be run for a given hypervisor. Default is nil.
70 71 72 |
# File 'lib/beaker/hypervisor.rb', line 70 def cleanup nil end |
#configure ⇒ Object
Default configuration steps to be run for a given hypervisor
75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/beaker/hypervisor.rb', line 75 def configure if [:timesync] timesync(@hosts, ) end if [:root_keys] sync_root_keys(@hosts, ) end if [:add_el_extras] add_el_extras(@hosts, ) end if [:add_master_entry] add_master_entry(@hosts, ) end end |
#generate_host_name ⇒ Object
Generate a random straing composted of letter and numbers
96 97 98 |
# File 'lib/beaker/hypervisor.rb', line 96 def generate_host_name CHARMAP[rand(25)] + (0...14).map{CHARMAP[rand(CHARMAP.length)]}.join end |
#provision ⇒ Object
Provisioning steps for be run for a given hypervisor. Default is nil.
65 66 67 |
# File 'lib/beaker/hypervisor.rb', line 65 def provision nil end |
#validate ⇒ Object
Default validation steps to be run for a given hypervisor
91 92 93 |
# File 'lib/beaker/hypervisor.rb', line 91 def validate validate_host(@hosts, ) end |