vagrant-ovirt4 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +8 -0
  3. data/.rspec +1 -0
  4. data/Gemfile +18 -0
  5. data/Gemfile.lock +54 -0
  6. data/README.md +110 -0
  7. data/Rakefile +22 -0
  8. data/example_box/README.md +13 -0
  9. data/example_box/Vagrantfile +14 -0
  10. data/example_box/metadata.json +4 -0
  11. data/lib/vagrant-ovirt4/action/connect_ovirt.rb +38 -0
  12. data/lib/vagrant-ovirt4/action/create_network_interfaces.rb +58 -0
  13. data/lib/vagrant-ovirt4/action/create_vm.rb +92 -0
  14. data/lib/vagrant-ovirt4/action/destroy_vm.rb +25 -0
  15. data/lib/vagrant-ovirt4/action/halt_vm.rb +23 -0
  16. data/lib/vagrant-ovirt4/action/is_created.rb +19 -0
  17. data/lib/vagrant-ovirt4/action/is_running.rb +19 -0
  18. data/lib/vagrant-ovirt4/action/message_already_up.rb +16 -0
  19. data/lib/vagrant-ovirt4/action/message_not_created.rb +16 -0
  20. data/lib/vagrant-ovirt4/action/message_not_suspended.rb +16 -0
  21. data/lib/vagrant-ovirt4/action/message_not_up.rb +16 -0
  22. data/lib/vagrant-ovirt4/action/message_powering_up.rb +16 -0
  23. data/lib/vagrant-ovirt4/action/message_saving_state.rb +16 -0
  24. data/lib/vagrant-ovirt4/action/read_ssh_info.rb +56 -0
  25. data/lib/vagrant-ovirt4/action/read_state.rb +47 -0
  26. data/lib/vagrant-ovirt4/action/set_name_of_domain.rb +24 -0
  27. data/lib/vagrant-ovirt4/action/snapshot_delete.rb +37 -0
  28. data/lib/vagrant-ovirt4/action/snapshot_list.rb +58 -0
  29. data/lib/vagrant-ovirt4/action/snapshot_save.rb +28 -0
  30. data/lib/vagrant-ovirt4/action/start_vm.rb +80 -0
  31. data/lib/vagrant-ovirt4/action/suspend_vm.rb +24 -0
  32. data/lib/vagrant-ovirt4/action/sync_folders.rb +69 -0
  33. data/lib/vagrant-ovirt4/action/wait_til_suspended.rb +44 -0
  34. data/lib/vagrant-ovirt4/action/wait_till_down.rb +47 -0
  35. data/lib/vagrant-ovirt4/action/wait_till_up.rb +83 -0
  36. data/lib/vagrant-ovirt4/action.rb +255 -0
  37. data/lib/vagrant-ovirt4/cap/snapshot_list.rb +12 -0
  38. data/lib/vagrant-ovirt4/cap/snapshot_save.rb +12 -0
  39. data/lib/vagrant-ovirt4/config.rb +49 -0
  40. data/lib/vagrant-ovirt4/errors.rb +48 -0
  41. data/lib/vagrant-ovirt4/plugin.rb +80 -0
  42. data/lib/vagrant-ovirt4/provider.rb +76 -0
  43. data/lib/vagrant-ovirt4/util/collection.rb +21 -0
  44. data/lib/vagrant-ovirt4/util/timer.rb +17 -0
  45. data/lib/vagrant-ovirt4/util.rb +9 -0
  46. data/lib/vagrant-ovirt4/version.rb +6 -0
  47. data/lib/vagrant-ovirt4.rb +38 -0
  48. data/locales/en.yml +74 -0
  49. data/spec/spec_helper.rb +1 -0
  50. data/spec/vagrant-ovirt4/action/is_created_spec.rb +40 -0
  51. data/spec/vagrant-ovirt4/action/is_running_spec.rb +40 -0
  52. data/spec/vagrant-ovirt4/action/message_already_up_spec.rb +20 -0
  53. data/spec/vagrant-ovirt4/action/message_not_created_spec.rb +20 -0
  54. data/spec/vagrant-ovirt4/action/message_not_suspended_spec.rb +20 -0
  55. data/spec/vagrant-ovirt4/action/message_not_up_spec.rb +20 -0
  56. data/spec/vagrant-ovirt4/action/message_powering_up_spec.rb +20 -0
  57. data/spec/vagrant-ovirt4/action/message_saving_state_spec.rb +20 -0
  58. data/spec/vagrant-ovirt4/action/read_ssh_info_spec.rb +73 -0
  59. data/spec/vagrant-ovirt4/action/read_state_spec.rb +68 -0
  60. data/spec/vagrant-ovirt4/config_spec.rb +55 -0
  61. data/tools/prepare_redhat_for_box.sh +113 -0
  62. data/vagrant-ovirt4.gemspec +26 -0
  63. metadata +180 -0
@@ -0,0 +1,255 @@
1
+ require 'vagrant/action/builder'
2
+
3
+ module VagrantPlugins
4
+ module OVirtProvider
5
+ module Action
6
+ # Include the built-in modules so we can use them as top-level things.
7
+ include Vagrant::Action::Builtin
8
+
9
+ # This action is called to bring the box up from nothing.
10
+ def self.action_up
11
+ Vagrant::Action::Builder.new.tap do |b|
12
+ b.use ConfigValidate
13
+ b.use ConnectOVirt
14
+ b.use Call, ReadState do |env, b2|
15
+ if env[:machine_state_id] == :up
16
+ b2.use SyncFolders
17
+ b2.use MessageAlreadyUp
18
+ next
19
+ end
20
+
21
+ if env[:machine_state_id] == :saving_state
22
+ b2.use MessageSavingState
23
+ next
24
+ end
25
+
26
+ if env[:machine_state_id] == :not_created
27
+ b2.use SetNameOfDomain
28
+ b2.use CreateVM
29
+ #b2.use ResizeDisk
30
+
31
+ b2.use Provision
32
+ b2.use CreateNetworkInterfaces
33
+
34
+ b2.use SetHostname
35
+ end
36
+
37
+ b2.use StartVM
38
+ b2.use WaitTillUp
39
+ b2.use SyncFolders
40
+ end
41
+ end
42
+ end
43
+
44
+ def self.action_destroy
45
+ Vagrant::Action::Builder.new.tap do |b|
46
+ b.use ConfigValidate
47
+ b.use Call, IsCreated do |env, b2|
48
+ if !env[:result]
49
+ b2.use MessageNotCreated
50
+ next
51
+ end
52
+
53
+ b2.use ConnectOVirt
54
+ b2.use ProvisionerCleanup, :before if defined?(ProvisionerCleanup)
55
+ b2.use HaltVM
56
+ b2.use WaitTillDown
57
+ b2.use DestroyVM
58
+ end
59
+ end
60
+ end
61
+
62
+ def self.action_provision
63
+ Vagrant::Action::Builder.new.tap do |b|
64
+ b.use ConfigValidate
65
+ b.use Call, IsCreated do |env, b2|
66
+ if !env[:result]
67
+ b2.use MessageNotCreated
68
+ next
69
+ end
70
+ b2.use Provision
71
+ b2.use SyncFolders
72
+ end
73
+ end
74
+ end
75
+
76
+ # This action is called to read the state of the machine. The resulting
77
+ # state is expected to be put into the `:machine_state_id` key.
78
+ def self.action_read_state
79
+ Vagrant::Action::Builder.new.tap do |b|
80
+ b.use ConfigValidate
81
+ b.use ConnectOVirt
82
+ b.use ReadState
83
+ end
84
+ end
85
+
86
+ # This action is called to read the SSH info of the machine. The
87
+ # resulting state is expected to be put into the `:machine_ssh_info`
88
+ # key.
89
+ def self.action_read_ssh_info
90
+ Vagrant::Action::Builder.new.tap do |b|
91
+ b.use ConfigValidate
92
+ b.use ConnectOVirt
93
+ b.use ReadSSHInfo
94
+ end
95
+ end
96
+
97
+ def self.action_ssh
98
+ Vagrant::Action::Builder.new.tap do |b|
99
+ b.use ConfigValidate
100
+ b.use ConnectOVirt
101
+ b.use Call, ReadState do |env, b2|
102
+ if env[:machine_state_id] == :not_created
103
+ b2.use MessageNotCreated
104
+ next
105
+ end
106
+ if env[:machine_state_id] != :up
107
+ b2.use MessageNotUp
108
+ next
109
+ end
110
+
111
+ raise Errors::NoIPError if env[:ip_address].nil?
112
+ b2.use SSHExec
113
+ end
114
+ end
115
+ end
116
+
117
+ def self.action_ssh_run
118
+ Vagrant::Action::Builder.new.tap do |b|
119
+ b.use ConfigValidate
120
+ b.use ConnectOVirt
121
+ b.use Call, ReadState do |env, b2|
122
+ if env[:machine_state_id] == :not_created
123
+ b2.use MessageNotCreated
124
+ next
125
+ end
126
+ if env[:machine_state_id] != :up
127
+ b2.use MessageNotUp
128
+ next
129
+ end
130
+
131
+ raise Errors::NoIPError if env[:ip_address].nil?
132
+ b2.use SSHRun
133
+ end
134
+ end
135
+ end
136
+
137
+
138
+ def self.action_halt
139
+ with_ovirt do |env, b|
140
+ b.use Call, IsRunning do |env2, b2|
141
+ if env[:machine_state_id] == :powering_up
142
+ b2.use MessagePoweringUp
143
+ next
144
+ end
145
+ if !env2[:result]
146
+ b2.use MessageNotUp
147
+ next
148
+ end
149
+ b2.use HaltVM
150
+ b2.use WaitTillDown
151
+ end
152
+ end
153
+ end
154
+
155
+ def self.action_reload
156
+ with_ovirt do |env, b|
157
+ b.use action_halt
158
+ b.use action_up
159
+ end
160
+ end
161
+
162
+ def self.action_suspend
163
+ with_ovirt do |env, b|
164
+ b.use Call, IsRunning do |env2, b2|
165
+ if env[:machine_state_id] == :powering_up
166
+ b2.use MessagePoweringUp
167
+ next
168
+ end
169
+ if !env2[:result]
170
+ b2.use MessageNotUp
171
+ next
172
+ end
173
+ b2.use SuspendVM
174
+ b2.use WaitTilSuspended
175
+ end
176
+ end
177
+ end
178
+
179
+ def self.action_resume
180
+ with_ovirt do |env, b|
181
+ if env[:machine_state_id] == :saving_state
182
+ b.use MessageSavingState
183
+ next
184
+ end
185
+ if env[:machine_state_id] != :suspended
186
+ b.use MessageNotSuspended
187
+ next
188
+ end
189
+ b.use action_up
190
+ end
191
+ end
192
+
193
+ def self.action_snapshot_list
194
+ with_ovirt do |env, b|
195
+ b.use SnapshotList
196
+ end
197
+ end
198
+
199
+ def self.action_snapshot_save
200
+ with_ovirt do |env, b|
201
+ b.use SnapshotSave
202
+ end
203
+ end
204
+
205
+ def self.action_snapshot_delete
206
+ with_ovirt do |env, b|
207
+ b.use SnapshotDelete
208
+ end
209
+ end
210
+
211
+ action_root = Pathname.new(File.expand_path("../action", __FILE__))
212
+ autoload :ConnectOVirt, action_root.join("connect_ovirt")
213
+ autoload :CreateNetworkInterfaces, action_root.join("create_network_interfaces")
214
+ autoload :CreateVM, action_root.join("create_vm")
215
+ autoload :DestroyVM, action_root.join("destroy_vm")
216
+ autoload :HaltVM, action_root.join("halt_vm")
217
+ autoload :IsCreated, action_root.join("is_created")
218
+ autoload :IsRunning, action_root.join("is_running")
219
+ autoload :ReadSSHInfo, action_root.join("read_ssh_info")
220
+ autoload :ReadState, action_root.join("read_state")
221
+ autoload :SetNameOfDomain, action_root.join("set_name_of_domain")
222
+ autoload :SnapshotDelete, action_root.join("snapshot_delete")
223
+ autoload :SnapshotList, action_root.join("snapshot_list")
224
+ autoload :SnapshotSave, action_root.join("snapshot_save")
225
+ autoload :StartVM, action_root.join("start_vm")
226
+ autoload :SuspendVM, action_root.join("suspend_vm")
227
+ autoload :SyncFolders, action_root.join("sync_folders")
228
+ autoload :WaitTillDown, action_root.join("wait_till_down")
229
+ autoload :WaitTillUp, action_root.join("wait_till_up")
230
+ autoload :WaitTilSuspended, action_root.join("wait_til_suspended")
231
+
232
+ autoload :MessageAlreadyUp, action_root.join("message_already_up")
233
+ autoload :MessageNotCreated, action_root.join("message_not_created")
234
+ autoload :MessageNotSuspended, action_root.join("message_not_suspended")
235
+ autoload :MessageNotUp, action_root.join("message_not_up")
236
+ autoload :MessagePoweringUp, action_root.join("message_powering_up")
237
+ autoload :MessageSavingState, action_root.join("message_saving_state")
238
+
239
+ private
240
+ def self.with_ovirt
241
+ Vagrant::Action::Builder.new.tap do |b|
242
+ b.use ConfigValidate
243
+ b.use ConnectOVirt
244
+ b.use Call, ReadState do |env, b2|
245
+ if !env[:machine_state_id] == :not_created
246
+ b2.use MessageNotCreated
247
+ next
248
+ end
249
+ yield env, b2
250
+ end
251
+ end
252
+ end
253
+ end
254
+ end
255
+ end
@@ -0,0 +1,12 @@
1
+ module VagrantPlugins
2
+ module OVirtProvider
3
+ module Cap
4
+ module SnapshotList
5
+ def self.snapshot_list(machine)
6
+ env = machine.action(:snapshot_list, lock: false)
7
+ env[:machine_snapshot_list]
8
+ end
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ module VagrantPlugins
2
+ module OVirtProvider
3
+ module Cap
4
+ module SnapshotSave
5
+ def self.snapshot_save(machine)
6
+ env = machine.action(:snapshot_save, lock: false)
7
+ env[:machine_snapshot_save]
8
+ end
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,49 @@
1
+ require 'vagrant'
2
+
3
+ module VagrantPlugins
4
+ module OVirtProvider
5
+ class Config < Vagrant.plugin('2', :config)
6
+
7
+ attr_accessor :url
8
+ attr_accessor :username
9
+ attr_accessor :password
10
+ attr_accessor :insecure
11
+ attr_accessor :debug
12
+ attr_accessor :cpus
13
+ attr_accessor :template
14
+ attr_accessor :memory
15
+ attr_accessor :cluster
16
+ attr_accessor :console
17
+
18
+ def initialize
19
+ @url = UNSET_VALUE
20
+ @username = UNSET_VALUE
21
+ @password = UNSET_VALUE
22
+ @insecure = UNSET_VALUE
23
+ @debug = UNSET_VALUE
24
+ @cpus = UNSET_VALUE
25
+ @template = UNSET_VALUE
26
+ @memory = UNSET_VALUE
27
+ @cluster = UNSET_VALUE
28
+ @console = UNSET_VALUE
29
+
30
+ end
31
+
32
+ def finalize!
33
+ @url = nil if @url == UNSET_VALUE
34
+ @username = nil if @username == UNSET_VALUE
35
+ @password = nil if @password == UNSET_VALUE
36
+ @insecure = false if @insecure == UNSET_VALUE
37
+ @debug = false if @debug == UNSET_VALUE
38
+ @cpus = 1 if @cpus == UNSET_VALUE
39
+ @cluster = nil if @cluster == UNSET_VALUE
40
+ @console = nil if @console == UNSET_VALUE
41
+ @memory = 256 if @memory == UNSET_VALUE
42
+ @template = nil if @template == UNSET_VALUE
43
+
44
+ end
45
+
46
+ end
47
+ end
48
+ end
49
+
@@ -0,0 +1,48 @@
1
+ require 'vagrant'
2
+
3
+ module VagrantPlugins
4
+ module OVirtProvider
5
+ module Errors
6
+ class VagrantOVirtError < Vagrant::Errors::VagrantError
7
+ error_namespace("vagrant_ovirt4.errors")
8
+ end
9
+
10
+ class NoVMError < VagrantOVirtError
11
+ error_key(:no_vm_error)
12
+ end
13
+
14
+ class CreateVMError < VagrantOVirtError
15
+ error_key(:create_vm_error)
16
+ end
17
+
18
+ class StartVMError < VagrantOVirtError
19
+ error_key(:start_vm_error)
20
+ end
21
+
22
+ class WaitForReadyVmTimeout < VagrantOVirtError
23
+ error_key(:wait_for_ready_vm_timeout)
24
+ end
25
+
26
+ class AddInterfaceError < VagrantOVirtError
27
+ error_key(:add_interface_error)
28
+ end
29
+
30
+ class NoNetworkError < VagrantOVirtError
31
+ error_key(:no_network_error)
32
+ end
33
+
34
+ class NoIPError < VagrantOVirtError
35
+ error_key(:no_ip_error)
36
+ end
37
+
38
+ class RemoveActiveSnapshotError < VagrantOVirtError
39
+ error_key(:remove_active_snapshot_error)
40
+ end
41
+
42
+ class RemoveSnapshotError < VagrantOVirtError
43
+ error_key(:remove_snapshot_error)
44
+ end
45
+ end
46
+ end
47
+ end
48
+
@@ -0,0 +1,80 @@
1
+ # vim: ai ts=2 sts=2 et sw=2 ft=ruby
2
+ begin
3
+ require 'vagrant'
4
+ rescue LoadError
5
+ raise "The Vagrant oVirt v4 plugin must be run within Vagrant."
6
+ end
7
+
8
+
9
+ # This is a sanity check to make sure no one is attempting to install
10
+ # this into an early Vagrant version.
11
+ if Vagrant::VERSION < '1.1.0'
12
+ raise "The Vagrant oVirt v4 plugin is only compatible with Vagrant 1.1+"
13
+ end
14
+
15
+ module VagrantPlugins
16
+ module OVirtProvider
17
+ class Plugin < Vagrant.plugin('2')
18
+ name "ovirt4"
19
+ description <<-DESC
20
+ Vagrant plugin to manage oVirt v4 machines.
21
+ DESC
22
+
23
+ provider_capability('ovirt4', 'snapshot_list') do
24
+ require_relative 'cap/snapshot_list'
25
+ Cap::SnapshotList
26
+ end
27
+
28
+ config("ovirt4", :provider) do
29
+ require_relative "config"
30
+ Config
31
+ end
32
+
33
+ provider("ovirt4", parallel: true) do
34
+ # Setup logging and i18n
35
+ setup_logging
36
+ setup_i18n
37
+
38
+ require_relative "provider"
39
+ Provider
40
+ end
41
+
42
+ # This initializes the internationalization strings.
43
+ def self.setup_i18n
44
+ I18n.load_path << File.expand_path("locales/en.yml",
45
+ OVirtProvider.source_root)
46
+ I18n.reload!
47
+ end
48
+
49
+ # This sets up our log level to be whatever VAGRANT_LOG is.
50
+ def self.setup_logging
51
+ require "log4r"
52
+
53
+ level = nil
54
+ begin
55
+ level = Log4r.const_get(ENV["VAGRANT_LOG"].upcase)
56
+ rescue NameError
57
+ # This means that the logging constant wasn't found,
58
+ # which is fine. We just keep `level` as `nil`. But
59
+ # we tell the user.
60
+ level = nil
61
+ end
62
+
63
+ # Some constants, such as "true" resolve to booleans, so the
64
+ # above error checking doesn't catch it. This will check to make
65
+ # sure that the log level is an integer, as Log4r requires.
66
+ level = nil if !level.is_a?(Integer)
67
+
68
+ # Set the logging level on all "vagrant" namespaced
69
+ # logs as long as we have a valid level.
70
+ if level
71
+ logger = Log4r::Logger.new("vagrant_ovirt4")
72
+ logger.outputters = Log4r::Outputter.stderr
73
+ logger.level = level
74
+ logger = nil
75
+ end
76
+ end
77
+ end
78
+ end
79
+ end
80
+
@@ -0,0 +1,76 @@
1
+ require 'vagrant'
2
+
3
+ module VagrantPlugins
4
+ module OVirtProvider
5
+
6
+ # This is the base class for a provider for the V2 API. A provider
7
+ # is responsible for creating compute resources to match the
8
+ # needs of a Vagrant-configured system.
9
+ class Provider < Vagrant.plugin('2', :provider)
10
+ def initialize(machine)
11
+ @machine = machine
12
+ end
13
+
14
+ # This should return an action callable for the given name.
15
+ def action(name)
16
+ # Attempt to get the action method from the Action class if it
17
+ # exists, otherwise return nil to show that we don't support the
18
+ # given action.
19
+ action_method = "action_#{name}"
20
+ return Action.send(action_method) if Action.respond_to?(action_method)
21
+ nil
22
+ end
23
+
24
+ # This method is called if the underying machine ID changes. Providers
25
+ # can use this method to load in new data for the actual backing
26
+ # machine or to realize that the machine is now gone (the ID can
27
+ # become `nil`).
28
+ def machine_id_changed
29
+ end
30
+
31
+ # This should return a hash of information that explains how to
32
+ # SSH into the machine. If the machine is not at a point where
33
+ # SSH is even possible, then `nil` should be returned.
34
+ def ssh_info
35
+ # Run a custom action called "read_ssh_info" which does what it says
36
+ # and puts the resulting SSH info into the `:machine_ssh_info` key in
37
+ # the environment.
38
+ #
39
+ # Ssh info has following format..
40
+ #
41
+ #{
42
+ # :host => "1.2.3.4",
43
+ # :port => "22",
44
+ # :username => "mitchellh",
45
+ # :private_key_path => "/path/to/my/key"
46
+ #}
47
+ env = @machine.action("read_ssh_info")
48
+ env[:machine_ssh_info]
49
+ end
50
+
51
+ # This should return the state of the machine within this provider.
52
+ # The state must be an instance of {MachineState}.
53
+ def state
54
+ # Run a custom action we define called "read_state" which does
55
+ # what it says. It puts the state in the `:machine_state_id`
56
+ # key in the environment.
57
+ env = @machine.action("read_state")
58
+
59
+ state_id = env[:machine_state_id]
60
+
61
+ # Get the short and long description
62
+ short = I18n.t("vagrant_ovirt4.states.short_#{state_id}")
63
+ long = I18n.t("vagrant_ovirt4.states.long_#{state_id}")
64
+
65
+ # Return the MachineState object
66
+ Vagrant::MachineState.new(state_id, short, long)
67
+ end
68
+
69
+ def to_s
70
+ id = @machine.id.nil? ? "new" : @machine.id
71
+ "oVirt (#{id})"
72
+ end
73
+ end
74
+ end
75
+ end
76
+
@@ -0,0 +1,21 @@
1
+ module VagrantPlugins
2
+ module OVirtProvider
3
+ module Util
4
+ module Collection
5
+ # This method finds a matching _thing_ in a collection of
6
+ # _things_. This works matching if the ID or NAME equals to
7
+ # `name`. Or, if `name` is a regexp, a partial match is chosen
8
+ # as well.
9
+ def self.find_matching(collection, name)
10
+ collection.each do |single|
11
+ return single if single.name == name
12
+ return single if single.id == name
13
+ end
14
+
15
+ nil
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+
@@ -0,0 +1,17 @@
1
+ module VagrantPlugins
2
+ module OVirtProvider
3
+ module Util
4
+ class Timer
5
+ # A basic utility method that times the execution of the given
6
+ # block and returns it.
7
+ def self.time
8
+ start_time = Time.now.to_f
9
+ yield
10
+ end_time = Time.now.to_f
11
+
12
+ end_time - start_time
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,9 @@
1
+ module VagrantPlugins
2
+ module OVirtProvider
3
+ module Util
4
+ autoload :Collection, 'vagrant-ovirt4/util/collection'
5
+ autoload :Timer, 'vagrant-ovirt4/util/timer'
6
+ end
7
+ end
8
+ end
9
+
@@ -0,0 +1,6 @@
1
+ module VagrantPlugins
2
+ module OVirtProvider
3
+ VERSION = '1.0.0'
4
+ end
5
+ end
6
+
@@ -0,0 +1,38 @@
1
+ require 'pathname'
2
+ require 'vagrant-ovirt4/plugin'
3
+
4
+ module VagrantPlugins
5
+ module OVirtProvider
6
+ lib_path = Pathname.new(File.expand_path("../vagrant-ovirt4", __FILE__))
7
+ autoload :Action, lib_path.join("action")
8
+ autoload :Errors, lib_path.join("errors")
9
+ autoload :Util, lib_path.join("util")
10
+
11
+ @@ovirt_connection = nil
12
+ @@vms_service = nil
13
+ def self.ovirt_connection
14
+ @@ovirt_connection
15
+ end
16
+
17
+ def self.ovirt_connection=(conn)
18
+ @@ovirt_connection = conn
19
+ end
20
+
21
+ def self.vms_service
22
+ @@vms_service
23
+ end
24
+
25
+ def self.vms_service=(conn)
26
+ @@vms_service = conn
27
+ end
28
+
29
+
30
+
31
+ # This returns the path to the source of this plugin.
32
+ #
33
+ # @return [Pathname]
34
+ def self.source_root
35
+ @source_root ||= Pathname.new(File.expand_path("../../", __FILE__))
36
+ end
37
+ end
38
+ end