vagrant-libvirt 0.0.40 → 0.0.41

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. checksums.yaml +4 -4
  2. metadata +13 -103
  3. data/.coveralls.yml +0 -1
  4. data/.github/issue_template.md +0 -37
  5. data/.gitignore +0 -21
  6. data/.travis.yml +0 -28
  7. data/CHANGELOG.md +0 -99
  8. data/Gemfile +0 -27
  9. data/LICENSE +0 -22
  10. data/README.md +0 -1311
  11. data/Rakefile +0 -8
  12. data/example_box/README.md +0 -29
  13. data/example_box/Vagrantfile +0 -60
  14. data/example_box/metadata.json +0 -5
  15. data/lib/vagrant-libvirt.rb +0 -29
  16. data/lib/vagrant-libvirt/action.rb +0 -362
  17. data/lib/vagrant-libvirt/action/create_domain.rb +0 -313
  18. data/lib/vagrant-libvirt/action/create_domain_volume.rb +0 -87
  19. data/lib/vagrant-libvirt/action/create_network_interfaces.rb +0 -294
  20. data/lib/vagrant-libvirt/action/create_networks.rb +0 -353
  21. data/lib/vagrant-libvirt/action/destroy_domain.rb +0 -83
  22. data/lib/vagrant-libvirt/action/destroy_networks.rb +0 -95
  23. data/lib/vagrant-libvirt/action/forward_ports.rb +0 -221
  24. data/lib/vagrant-libvirt/action/halt_domain.rb +0 -35
  25. data/lib/vagrant-libvirt/action/handle_box_image.rb +0 -156
  26. data/lib/vagrant-libvirt/action/handle_storage_pool.rb +0 -57
  27. data/lib/vagrant-libvirt/action/is_created.rb +0 -18
  28. data/lib/vagrant-libvirt/action/is_running.rb +0 -21
  29. data/lib/vagrant-libvirt/action/is_suspended.rb +0 -42
  30. data/lib/vagrant-libvirt/action/message_already_created.rb +0 -16
  31. data/lib/vagrant-libvirt/action/message_not_created.rb +0 -16
  32. data/lib/vagrant-libvirt/action/message_not_running.rb +0 -16
  33. data/lib/vagrant-libvirt/action/message_not_suspended.rb +0 -16
  34. data/lib/vagrant-libvirt/action/package_domain.rb +0 -105
  35. data/lib/vagrant-libvirt/action/prepare_nfs_settings.rb +0 -94
  36. data/lib/vagrant-libvirt/action/prepare_nfs_valid_ids.rb +0 -17
  37. data/lib/vagrant-libvirt/action/prune_nfs_exports.rb +0 -27
  38. data/lib/vagrant-libvirt/action/read_mac_addresses.rb +0 -40
  39. data/lib/vagrant-libvirt/action/remove_libvirt_image.rb +0 -20
  40. data/lib/vagrant-libvirt/action/remove_stale_volume.rb +0 -50
  41. data/lib/vagrant-libvirt/action/resume_domain.rb +0 -34
  42. data/lib/vagrant-libvirt/action/set_boot_order.rb +0 -109
  43. data/lib/vagrant-libvirt/action/set_name_of_domain.rb +0 -64
  44. data/lib/vagrant-libvirt/action/share_folders.rb +0 -71
  45. data/lib/vagrant-libvirt/action/start_domain.rb +0 -303
  46. data/lib/vagrant-libvirt/action/suspend_domain.rb +0 -40
  47. data/lib/vagrant-libvirt/action/wait_till_up.rb +0 -102
  48. data/lib/vagrant-libvirt/cap/mount_p9.rb +0 -42
  49. data/lib/vagrant-libvirt/cap/nic_mac_addresses.rb +0 -17
  50. data/lib/vagrant-libvirt/cap/synced_folder.rb +0 -113
  51. data/lib/vagrant-libvirt/config.rb +0 -698
  52. data/lib/vagrant-libvirt/driver.rb +0 -118
  53. data/lib/vagrant-libvirt/errors.rb +0 -149
  54. data/lib/vagrant-libvirt/plugin.rb +0 -92
  55. data/lib/vagrant-libvirt/provider.rb +0 -130
  56. data/lib/vagrant-libvirt/templates/default_storage_pool.xml.erb +0 -13
  57. data/lib/vagrant-libvirt/templates/domain.xml.erb +0 -229
  58. data/lib/vagrant-libvirt/templates/private_network.xml.erb +0 -34
  59. data/lib/vagrant-libvirt/templates/public_interface.xml.erb +0 -23
  60. data/lib/vagrant-libvirt/util.rb +0 -11
  61. data/lib/vagrant-libvirt/util/collection.rb +0 -19
  62. data/lib/vagrant-libvirt/util/erb_template.rb +0 -22
  63. data/lib/vagrant-libvirt/util/error_codes.rb +0 -100
  64. data/lib/vagrant-libvirt/util/network_util.rb +0 -138
  65. data/lib/vagrant-libvirt/util/timer.rb +0 -17
  66. data/lib/vagrant-libvirt/version.rb +0 -5
  67. data/locales/en.yml +0 -159
  68. data/spec/spec_helper.rb +0 -9
  69. data/spec/support/environment_helper.rb +0 -46
  70. data/spec/support/libvirt_context.rb +0 -30
  71. data/spec/support/sharedcontext.rb +0 -34
  72. data/spec/unit/action/destroy_domain_spec.rb +0 -97
  73. data/spec/unit/action/set_name_of_domain_spec.rb +0 -21
  74. data/spec/unit/action/wait_till_up_spec.rb +0 -127
  75. data/spec/unit/config_spec.rb +0 -106
  76. data/spec/unit/templates/domain_all_settings.xml +0 -133
  77. data/spec/unit/templates/domain_defaults.xml +0 -46
  78. data/spec/unit/templates/domain_spec.rb +0 -75
  79. data/tools/create_box.sh +0 -130
  80. data/tools/prepare_redhat_for_box.sh +0 -119
  81. data/vagrant-libvirt.gemspec +0 -28
data/Rakefile DELETED
@@ -1,8 +0,0 @@
1
- #require 'rubygems'
2
- #require 'bundler/setup'
3
- require 'bundler/gem_tasks'
4
- Bundler::GemHelper.install_tasks
5
- task default: [:deftask]
6
- task :deftask do
7
- puts 'call rake -T'
8
- end
@@ -1,29 +0,0 @@
1
- # Vagrant Libvirt Example Box
2
-
3
- Vagrant providers each require a custom provider-specific box format.
4
- This folder shows the example contents of a box for the `libvirt` provider.
5
- To turn this into a box create a vagrant image according documentation (don't
6
- forget to install rsync command) and create box with following command:
7
-
8
- ```
9
- $ tar cvzf custom_box.box ./metadata.json ./Vagrantfile ./box.img
10
- ```
11
-
12
- This box works by using Vagrant's built-in Vagrantfile merging to setup
13
- defaults for Libvirt. These defaults can easily be overwritten by higher-level
14
- Vagrantfiles (such as project root Vagrantfiles).
15
-
16
- ## Box Metadata
17
-
18
- Libvirt box should define at least three data fields in `metadata.json` file.
19
-
20
- * provider - Provider name is libvirt.
21
- * format - Currently supported format is qcow2.
22
- * virtual_size - Virtual size of image in GBytes.
23
-
24
- ## Converting Boxes
25
-
26
- Instead of creating a box from scratch, you can use
27
- [vagrant-mutate](https://github.com/sciurus/vagrant-mutate)
28
- to take boxes created for other Vagrant providers and use them
29
- with vagrant-libvirt.
@@ -1,60 +0,0 @@
1
- # -*- mode: ruby -*-
2
- # vi: set ft=ruby :
3
-
4
- Vagrant.configure("2") do |config|
5
-
6
- # Example configuration of new VM..
7
- #
8
- #config.vm.define :test_vm do |test_vm|
9
- # Box name
10
- #
11
- #test_vm.vm.box = "centos64"
12
-
13
- # Domain Specific Options
14
- #
15
- # See README for more info.
16
- #
17
- #test_vm.vm.provider :libvirt do |domain|
18
- # domain.memory = 2048
19
- # domain.cpus = 2
20
- #end
21
-
22
- # Interfaces for VM
23
- #
24
- # Networking features in the form of `config.vm.network`
25
- #
26
- #test_vm.vm.network :private_network, :ip => '10.20.30.40'
27
- #test_vm.vm.network :public_network, :ip => '10.20.30.41'
28
- #end
29
-
30
- # Options for libvirt vagrant provider.
31
- config.vm.provider :libvirt do |libvirt|
32
-
33
- # A hypervisor name to access. Different drivers can be specified, but
34
- # this version of provider creates KVM machines only. Some examples of
35
- # drivers are kvm (qemu hardware accelerated), qemu (qemu emulated),
36
- # xen (Xen hypervisor), lxc (Linux Containers),
37
- # esx (VMware ESX), vmwarews (VMware Workstation) and more. Refer to
38
- # documentation for available drivers (http://libvirt.org/drivers.html).
39
- libvirt.driver = "kvm"
40
-
41
- # The name of the server, where libvirtd is running.
42
- # libvirt.host = "localhost"
43
-
44
- # If use ssh tunnel to connect to Libvirt.
45
- libvirt.connect_via_ssh = false
46
-
47
- # The username and password to access Libvirt. Password is not used when
48
- # connecting via ssh.
49
- libvirt.username = "root"
50
- #libvirt.password = "secret"
51
-
52
- # Libvirt storage pool name, where box image and instance snapshots will
53
- # be stored.
54
- libvirt.storage_pool_name = "default"
55
-
56
- # Set a prefix for the machines that's different than the project dir name.
57
- #libvirt.default_prefix = ''
58
- end
59
- end
60
-
@@ -1,5 +0,0 @@
1
- {
2
- "provider" : "libvirt",
3
- "format" : "qcow2",
4
- "virtual_size" : 16
5
- }
@@ -1,29 +0,0 @@
1
- require 'pathname'
2
-
3
- module VagrantPlugins
4
- module ProviderLibvirt
5
- lib_path = Pathname.new(File.expand_path('../vagrant-libvirt', __FILE__))
6
- autoload :Action, lib_path.join('action')
7
- autoload :Errors, lib_path.join('errors')
8
- autoload :Util, lib_path.join('util')
9
-
10
- def self.source_root
11
- @source_root ||= Pathname.new(File.expand_path('../../', __FILE__))
12
- end
13
- end
14
- end
15
-
16
- begin
17
- require 'vagrant'
18
- rescue LoadError
19
- raise 'The Vagrant Libvirt plugin must be run within Vagrant.'
20
- end
21
-
22
- # This is a sanity check to make sure no one is attempting to install
23
- # this into an early Vagrant version.
24
- if Vagrant::VERSION < '1.5.0'
25
- raise 'The Vagrant Libvirt plugin is only compatible with Vagrant 1.5+.'
26
- end
27
-
28
- # make sure base module class defined before loading plugin
29
- require 'vagrant-libvirt/plugin'
@@ -1,362 +0,0 @@
1
- require 'vagrant/action/builder'
2
- require 'log4r'
3
-
4
- module VagrantPlugins
5
- module ProviderLibvirt
6
- module Action
7
- # Include the built-in modules so we can use them as top-level things.
8
- include Vagrant::Action::Builtin
9
- @logger = Log4r::Logger.new('vagrant_libvirt::action')
10
-
11
- # remove image from libvirt storage pool
12
- def self.remove_libvirt_image
13
- Vagrant::Action::Builder.new.tap do |b|
14
- b.use RemoveLibvirtImage
15
- end
16
- end
17
-
18
- # This action is called to bring the box up from nothing.
19
- def self.action_up
20
- Vagrant::Action::Builder.new.tap do |b|
21
- b.use ConfigValidate
22
- b.use Call, IsCreated do |env, b2|
23
- # Create VM if not yet created.
24
- if !env[:result]
25
- b2.use SetNameOfDomain
26
- if !env[:machine].config.vm.box
27
- b2.use CreateDomain
28
- b2.use CreateNetworks
29
- b2.use CreateNetworkInterfaces
30
- b2.use SetBootOrder
31
- b2.use StartDomain
32
- else
33
- b2.use HandleStoragePool
34
- b2.use HandleBox
35
- b2.use HandleBoxImage
36
- b2.use CreateDomainVolume
37
- b2.use CreateDomain
38
-
39
- b2.use Provision
40
- b2.use PrepareNFSValidIds
41
- b2.use SyncedFolderCleanup
42
- b2.use SyncedFolders
43
- b2.use PrepareNFSSettings
44
- b2.use ShareFolders
45
- b2.use CreateNetworks
46
- b2.use CreateNetworkInterfaces
47
- b2.use SetBootOrder
48
-
49
- b2.use StartDomain
50
- b2.use WaitTillUp
51
-
52
- b2.use ForwardPorts
53
- b2.use SetHostname
54
- # b2.use SyncFolders
55
- end
56
- else
57
- b2.use action_start
58
- end
59
- end
60
- end
61
- end
62
-
63
- # Assuming VM is created, just start it. This action is not called
64
- # directly by any subcommand. VM can be suspended, already running or in
65
- # poweroff state.
66
- def self.action_start
67
- Vagrant::Action::Builder.new.tap do |b|
68
- b.use ConfigValidate
69
- b.use Call, IsRunning do |env, b2|
70
- # If the VM is running, run the necessary provisioners
71
- if env[:result]
72
- b2.use action_provision
73
- next
74
- end
75
-
76
- b2.use Call, IsSuspended do |env2, b3|
77
- # if vm is suspended resume it then exit
78
- if env2[:result]
79
- b3.use CreateNetworks
80
- b3.use ResumeDomain
81
- next
82
- end
83
-
84
- if !env[:machine].config.vm.box
85
- # With no box, we just care about network creation and starting it
86
- b3.use CreateNetworks
87
- b3.use SetBootOrder
88
- b3.use StartDomain
89
- else
90
- # VM is not running or suspended.
91
-
92
- b3.use Provision
93
-
94
- # Ensure networks are created and active
95
- b3.use CreateNetworks
96
- b3.use SetBootOrder
97
-
98
- b3.use PrepareNFSValidIds
99
- b3.use SyncedFolderCleanup
100
- b3.use SyncedFolders
101
-
102
- # Start it..
103
- b3.use StartDomain
104
-
105
- # Machine should gain IP address when comming up,
106
- # so wait for dhcp lease and store IP into machines data_dir.
107
- b3.use WaitTillUp
108
-
109
- b3.use ForwardPorts
110
- b3.use PrepareNFSSettings
111
- b3.use ShareFolders
112
- end
113
- end
114
- end
115
- end
116
- end
117
-
118
- # This is the action that is primarily responsible for halting the
119
- # virtual machine.
120
- def self.action_halt
121
- Vagrant::Action::Builder.new.tap do |b|
122
- b.use ConfigValidate
123
- b.use ClearForwardedPorts
124
- b.use Call, IsCreated do |env, b2|
125
- unless env[:result]
126
- b2.use MessageNotCreated
127
- next
128
- end
129
-
130
- b2.use Call, IsSuspended do |env2, b3|
131
- b3.use CreateNetworks if env2[:result]
132
- b3.use ResumeDomain if env2[:result]
133
- end
134
-
135
- b2.use Call, IsRunning do |env2, b3|
136
- next unless env2[:result]
137
-
138
- # VM is running, halt it.
139
- b3.use HaltDomain
140
- end
141
- end
142
- end
143
- end
144
-
145
- # This is the action implements the reload command
146
- # It uses the halt and start actions
147
- def self.action_reload
148
- Vagrant::Action::Builder.new.tap do |b|
149
- b.use Call, IsCreated do |env, b2|
150
- unless env[:result]
151
- b2.use MessageNotCreated
152
- next
153
- end
154
-
155
- b2.use ConfigValidate
156
- b2.use action_halt
157
- b2.use action_start
158
- end
159
- end
160
- end
161
-
162
- # not implemented and looks like not require
163
- def self.action_package
164
- Vagrant::Action::Builder.new.tap do |b|
165
- b.use ConfigValidate
166
- b.use PackageDomain
167
- end
168
- end
169
-
170
- # This is the action that is primarily responsible for completely
171
- # freeing the resources of the underlying virtual machine.
172
- def self.action_destroy
173
- Vagrant::Action::Builder.new.tap do |b|
174
- b.use ConfigValidate
175
- b.use Call, IsCreated do |env, b2|
176
- unless env[:result]
177
- # Try to remove stale volumes anyway
178
- b2.use SetNameOfDomain
179
- b2.use RemoveStaleVolume if env[:machine].config.vm.box
180
- b2.use MessageNotCreated unless env[:result]
181
-
182
- next
183
- end
184
-
185
- b2.use ClearForwardedPorts
186
- # b2.use PruneNFSExports
187
- b2.use DestroyDomain
188
- b2.use DestroyNetworks
189
- b2.use ProvisionerCleanup
190
- end
191
- end
192
- end
193
-
194
- # This action is called to SSH into the machine.
195
- def self.action_ssh
196
- Vagrant::Action::Builder.new.tap do |b|
197
- b.use ConfigValidate
198
- b.use Call, IsCreated do |env, b2|
199
- unless env[:result]
200
- b2.use MessageNotCreated
201
- next
202
- end
203
-
204
- b2.use Call, IsRunning do |env2, b3|
205
- unless env2[:result]
206
- b3.use MessageNotRunning
207
- next
208
- end
209
-
210
- b3.use SSHExec
211
- end
212
- end
213
- end
214
- end
215
-
216
- # This action is called when `vagrant provision` is called.
217
- def self.action_provision
218
- Vagrant::Action::Builder.new.tap do |b|
219
- b.use ConfigValidate
220
- b.use Call, IsCreated do |env, b2|
221
- unless env[:result]
222
- b2.use MessageNotCreated
223
- next
224
- end
225
-
226
- b2.use Call, IsRunning do |env2, b3|
227
- unless env2[:result]
228
- b3.use MessageNotRunning
229
- next
230
- end
231
-
232
- b3.use Provision
233
- # b3.use SyncFolders
234
- end
235
- end
236
- end
237
- end
238
-
239
- # This is the action that is primarily responsible for suspending
240
- # the virtual machine.
241
- def self.action_suspend
242
- Vagrant::Action::Builder.new.tap do |b|
243
- b.use ConfigValidate
244
- b.use Call, IsCreated do |env, b2|
245
- unless env[:result]
246
- b2.use MessageNotCreated
247
- next
248
- end
249
-
250
- b2.use Call, IsRunning do |env2, b3|
251
- unless env2[:result]
252
- b3.use MessageNotRunning
253
- next
254
- end
255
- b3.use SuspendDomain
256
- end
257
- end
258
- end
259
- end
260
-
261
- # This is the action that is primarily responsible for resuming
262
- # suspended machines.
263
- def self.action_resume
264
- Vagrant::Action::Builder.new.tap do |b|
265
- b.use ConfigValidate
266
- b.use Call, IsCreated do |env, b2|
267
- unless env[:result]
268
- b2.use MessageNotCreated
269
- next
270
- end
271
-
272
- b2.use Call, IsSuspended do |env2, b3|
273
- unless env2[:result]
274
- b3.use MessageNotSuspended
275
- next
276
- end
277
- b3.use CreateNetworks
278
- b3.use ResumeDomain
279
- end
280
- end
281
- end
282
- end
283
-
284
- def self.action_read_mac_addresses
285
- Vagrant::Action::Builder.new.tap do |b|
286
- b.use ConfigValidate
287
- b.use ReadMacAddresses
288
- end
289
- end
290
-
291
- # This is the action that will run a single SSH command.
292
- def self.action_ssh_run
293
- Vagrant::Action::Builder.new.tap do |b|
294
- b.use ConfigValidate
295
- b.use Call, IsCreated do |env, b2|
296
- unless env[:result]
297
- b2.use MessageNotCreated
298
- next
299
- end
300
-
301
- b2.use Call, IsRunning do |env2, b3|
302
- unless env2[:result]
303
- b3.use MessageNotRunning
304
- next
305
- end
306
-
307
- b3.use SSHRun
308
- end
309
- end
310
- end
311
- end
312
-
313
- action_root = Pathname.new(File.expand_path('../action', __FILE__))
314
- autoload :PackageDomain, action_root.join('package_domain')
315
- autoload :CreateDomain, action_root.join('create_domain')
316
- autoload :CreateDomainVolume, action_root.join('create_domain_volume')
317
- autoload :CreateNetworkInterfaces, action_root.join('create_network_interfaces')
318
- autoload :CreateNetworks, action_root.join('create_networks')
319
- autoload :DestroyDomain, action_root.join('destroy_domain')
320
- autoload :DestroyNetworks, action_root.join('destroy_networks')
321
- autoload :ForwardPorts, action_root.join('forward_ports')
322
- autoload :ClearForwardedPorts, action_root.join('forward_ports')
323
- autoload :HaltDomain, action_root.join('halt_domain')
324
- autoload :HandleBoxImage, action_root.join('handle_box_image')
325
- autoload :HandleStoragePool, action_root.join('handle_storage_pool')
326
- autoload :RemoveLibvirtImage, action_root.join('remove_libvirt_image')
327
- autoload :IsCreated, action_root.join('is_created')
328
- autoload :IsRunning, action_root.join('is_running')
329
- autoload :IsSuspended, action_root.join('is_suspended')
330
- autoload :MessageAlreadyCreated, action_root.join('message_already_created')
331
- autoload :MessageNotCreated, action_root.join('message_not_created')
332
- autoload :MessageNotRunning, action_root.join('message_not_running')
333
- autoload :MessageNotSuspended, action_root.join('message_not_suspended')
334
-
335
- autoload :RemoveStaleVolume, action_root.join('remove_stale_volume')
336
-
337
- autoload :PrepareNFSSettings, action_root.join('prepare_nfs_settings')
338
- autoload :PrepareNFSValidIds, action_root.join('prepare_nfs_valid_ids')
339
- autoload :PruneNFSExports, action_root.join('prune_nfs_exports')
340
-
341
- autoload :ReadMacAddresses, action_root.join('read_mac_addresses')
342
- autoload :ResumeDomain, action_root.join('resume_domain')
343
- autoload :SetNameOfDomain, action_root.join('set_name_of_domain')
344
- autoload :SetBootOrder, action_root.join('set_boot_order')
345
-
346
- # I don't think we need it anymore
347
- autoload :ShareFolders, action_root.join('share_folders')
348
- autoload :StartDomain, action_root.join('start_domain')
349
- autoload :SuspendDomain, action_root.join('suspend_domain')
350
- autoload :TimedProvision, action_root.join('timed_provision')
351
-
352
- autoload :WaitTillUp, action_root.join('wait_till_up')
353
- autoload :PrepareNFSValidIds, action_root.join('prepare_nfs_valid_ids')
354
-
355
- autoload :SSHRun, 'vagrant/action/builtin/ssh_run'
356
- autoload :HandleBox, 'vagrant/action/builtin/handle_box'
357
- autoload :SyncedFolders, 'vagrant/action/builtin/synced_folders'
358
- autoload :SyncedFolderCleanup, 'vagrant/action/builtin/synced_folder_cleanup'
359
- autoload :ProvisionerCleanup, 'vagrant/action/builtin/provisioner_cleanup'
360
- end
361
- end
362
- end