Method: Beaker::NetworkManager#provision

Defined in:
lib/beaker/network_manager.rb

#provisionObject

Provision all virtual machines. Provision machines according to their set hypervisor, if no hypervisor is selected assume that the described hosts are already up and reachable and do no provisioning.



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/beaker/network_manager.rb', line 50

def provision
  if @hypervisors
    cleanup
  end
  @hypervisors = {}
  #sort hosts by their hypervisor, use hypervisor 'none' if no hypervisor is specified
  hostless_options = Beaker::Options::OptionsHash.new.merge(@options.select{ |k,v| k.to_s !~ /HOSTS/})
  @options['HOSTS'].each_key do |name|
    host_hash = @options['HOSTS'][name]
    hypervisor = host_hash['hypervisor']
    if @options[:provision]
      hypervisor = provision?(@options, host_hash) ? host_hash['hypervisor'] : 'none'
    end
    @logger.debug "Hypervisor for #{name} is #{hypervisor}"
    @machines[hypervisor] = [] unless @machines[hypervisor]
    hostless_options[:timesync] = host_hash[:timesync] if host_hash[:timesync]!=nil
    host_itself = Beaker::Host.create(name, host_hash, hostless_options)
    host_itself.validate_setup
    @machines[hypervisor] << host_itself
  end

  @machines.each_key do |type|
    @hypervisors[type] = Beaker::Hypervisor.create(type, @machines[type], @options)
    @hosts << @machines[type]
    @machines[type].each do |host|
      log_sut_event host, true
    end
  end
  @hosts = @hosts.flatten
  @hosts
end