4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/beaker/hypervisor/aixer.rb', line 4
def initialize(aix_hosts, options, config)
@options = options
@config = config['CONFIG'].dup
@logger = options[:logger]
@aix_hosts = aix_hosts
fog_file = nil
if File.exists?( File.join(ENV['HOME'], '.fog') )
fog_file = YAML.load_file( File.join(ENV['HOME'], '.fog') )
end
raise "Cant load ~/.fog config" unless fog_file
hypername = fog_file[:default][:aix_hypervisor_server]
hyperconf = {
'HOSTS' => {
hypername => { 'platform' => 'el-6-x86_64' }
},
'CONFIG' => {
'user' => fog_file[:default][:aix_hypervisor_username] || ENV['USER'],
'ssh' => {
:keys => fog_file[:default][:aix_hypervisor_keyfile] || "#{ENV['HOME']}/.ssh/id_rsa"
}
}
}
hyperconfig = Beaker::TestConfig.new( hyperconf, @options )
@logger.notify "Connecting to hypervisor at #{hypername}"
hypervisor = Beaker::Host.create( hypername, @options, hyperconfig )
@aix_hosts.each do |host|
vm_name = host['vmname'] || host.name
@logger.notify "Reverting #{vm_name} to aix clean state"
start = Time.now
hypervisor.exec(Command.new("cd pe-aix && rake restore:#{host.name}"))
time = Time.now - start
@logger.notify "Spent %.2f seconds reverting" % time
end
hypervisor.close
end
|