Class: Mccloud::Provider::Libvirt::Provider
Instance Attribute Summary collapse
#credentials_path
#env, #namespace
Instance Method Summary
collapse
-
#bootstrap(selection, script, options) ⇒ Object
-
#destroy(selection, options) ⇒ Object
-
#halt(selection, options) ⇒ Object
-
#initialize(name, options, env) ⇒ Provider
constructor
A new instance of Provider.
-
#provision(selection, options) ⇒ Object
-
#raw ⇒ Object
-
#reload(selection, options) ⇒ Object
-
#ssh(selection, command, options) ⇒ Object
-
#up(selection, options) ⇒ Object
#status
#check_fog_credentials
#check_gem_availability, #filter, #get_component, #hosts, #method_missing, #on_selected_components
Constructor Details
#initialize(name, options, env) ⇒ Provider
Returns a new instance of Provider.
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/mccloud/provider/libvirt/provider.rb', line 20
def initialize(name,options,env)
super
@vms=Hash.new
@options=options
@flavor=self.class.to_s.split("::")[-2]
@name=name
required_gems=%w{ruby-libvirt fog}
check_gem_availability(required_gems)
require 'libvirt'
require 'fog'
end
|
Instance Attribute Details
#flavor ⇒ Object
Returns the value of attribute flavor.
11
12
13
|
# File 'lib/mccloud/provider/libvirt/provider.rb', line 11
def flavor
@flavor
end
|
#name ⇒ Object
Returns the value of attribute name.
10
11
12
|
# File 'lib/mccloud/provider/libvirt/provider.rb', line 10
def name
@name
end
|
#options ⇒ Object
Returns the value of attribute options.
13
14
15
|
# File 'lib/mccloud/provider/libvirt/provider.rb', line 13
def options
@options
end
|
#vms ⇒ Object
Returns the value of attribute vms.
15
16
17
|
# File 'lib/mccloud/provider/libvirt/provider.rb', line 15
def vms
@vms
end
|
Instance Method Details
#bootstrap(selection, script, options) ⇒ Object
55
56
57
58
59
|
# File 'lib/mccloud/provider/libvirt/provider.rb', line 55
def bootstrap(selection,script,options)
on_selected_components("vm",selection) do |id,vm|
vm._bootstrap(script,options)
end
end
|
#destroy(selection, options) ⇒ Object
61
62
63
64
65
|
# File 'lib/mccloud/provider/libvirt/provider.rb', line 61
def destroy(selection,options)
on_selected_components("vm",selection) do |id,vm|
vm.destroy(options)
end
end
|
#halt(selection, options) ⇒ Object
81
82
83
84
85
|
# File 'lib/mccloud/provider/libvirt/provider.rb', line 81
def halt(selection,options)
on_selected_components("vm",selection) do |id,vm|
vm.halt(options)
end
end
|
#provision(selection, options) ⇒ Object
75
76
77
78
79
|
# File 'lib/mccloud/provider/libvirt/provider.rb', line 75
def provision(selection,options)
on_selected_components("vm",selection) do |id,vm|
vm._provision(options)
end
end
|
#raw ⇒ Object
37
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/mccloud/provider/libvirt/provider.rb', line 37
def raw
if @raw.nil?
begin
@raw=::Fog::Compute.new({:provider => "Libvirt"}.merge(@options))
rescue ArgumentError => e
env.ui.error "Error loading raw provider : #{e.to_s} #{$!}"
@raw=nil
end
end
return @raw
end
|
#reload(selection, options) ⇒ Object
87
88
89
90
91
|
# File 'lib/mccloud/provider/libvirt/provider.rb', line 87
def reload(selection,options)
on_selected_components("vm",selection) do |id,vm|
vm.reload(options)
end
end
|
#ssh(selection, command, options) ⇒ Object
67
68
69
70
71
|
# File 'lib/mccloud/provider/libvirt/provider.rb', line 67
def ssh(selection,command,options)
on_selected_components("vm",selection) do |id,vm|
vm.ssh(command,options)
end
end
|
#up(selection, options) ⇒ Object
49
50
51
52
53
|
# File 'lib/mccloud/provider/libvirt/provider.rb', line 49
def up(selection,options)
on_selected_components("vm",selection) do |id,vm|
vm.up(options)
end
end
|