2012-04-02 07:25:03 -04:00
|
|
|
def test_template_name
|
2012-06-07 13:26:47 -04:00
|
|
|
ENV['FOG_XENSERVER_TEMPLATE'] || 'squeeze-test'
|
2012-04-02 07:25:03 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_ephemeral_vm_name
|
|
|
|
'fog-test-server-shindo'
|
|
|
|
end
|
|
|
|
|
2012-04-12 14:59:53 -04:00
|
|
|
def valid_ref?(ref)
|
|
|
|
(ref =~ /OpaqueRef:/) and \
|
|
|
|
(ref != "OpaqueRef:NULL" )
|
|
|
|
end
|
2012-04-19 04:53:56 -04:00
|
|
|
|
|
|
|
def create_ephemeral_vm
|
2014-05-26 09:44:18 -04:00
|
|
|
Fog::Compute[:xenserver].servers.create(:name => test_ephemeral_vm_name,
|
2012-04-19 04:53:56 -04:00
|
|
|
:template_name => test_template_name)
|
|
|
|
end
|
2012-05-28 16:22:26 -04:00
|
|
|
|
2012-04-19 04:53:56 -04:00
|
|
|
def create_ephemeral_server
|
|
|
|
create_ephemeral_vm
|
|
|
|
end
|
|
|
|
|
|
|
|
def destroy_ephemeral_servers
|
|
|
|
servers = Fog::Compute[:xenserver].servers
|
|
|
|
# Teardown cleanup
|
|
|
|
(servers.all :name_matches => test_ephemeral_vm_name).each do |s|
|
|
|
|
s.destroy
|
|
|
|
end
|
2014-05-22 21:40:43 -04:00
|
|
|
(servers.templates.select { |t| t.name == test_ephemeral_vm_name}).each do |s|
|
2012-04-19 04:53:56 -04:00
|
|
|
s.destroy
|
|
|
|
end
|
|
|
|
end
|
2012-05-28 16:22:26 -04:00
|
|
|
|
2012-04-19 04:53:56 -04:00
|
|
|
def destroy_ephemeral_vms
|
|
|
|
destroy_ephemeral_servers
|
|
|
|
end
|