vagrant-libvirt 0.0.24 → 0.0.25
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.
- checksums.yaml +4 -4
- data/README.md +2 -4
- data/Rakefile +0 -2
- data/example_box/Vagrantfile +2 -3
- data/lib/vagrant-libvirt/action/connect_libvirt.rb +1 -1
- data/lib/vagrant-libvirt/action/create_domain.rb +2 -2
- data/lib/vagrant-libvirt/action/create_network_interfaces.rb +2 -1
- data/lib/vagrant-libvirt/action/create_networks.rb +1 -1
- data/lib/vagrant-libvirt/action/handle_box_image.rb +44 -39
- data/lib/vagrant-libvirt/action/handle_storage_pool.rb +31 -25
- data/lib/vagrant-libvirt/templates/domain.xml.erb +1 -1
- data/lib/vagrant-libvirt/version.rb +1 -1
- data/vagrant-libvirt.gemspec +2 -2
- metadata +5 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a9f2dc33e98d6a6508eef0d5f08104cf021f9f7
|
4
|
+
data.tar.gz: b42c0511ec12193843ebae0bd285598327847810
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f2a7909225e3a571d75c96cfa4221baca176e17c48afc725c6d499f3eb6e63a33983a222492d64c043d7565b0623f3ca87c00d33ca27e0e51b55db0a14c33922
|
7
|
+
data.tar.gz: a997be0c048ea6708a40462074a5468c1f466e2a2cc1fc64b5ca76866b97ecf7909ec10bc29c04eae6fd635ec483a305b7e70b81caae1f5f568893295f0a88a5
|
data/README.md
CHANGED
@@ -31,7 +31,7 @@ welcome and can help a lot :-)
|
|
31
31
|
|
32
32
|
First, you should have libvirt installed if you plan to run VMs on your local system. For instructions, refer to your linux distribution's documentation,
|
33
33
|
|
34
|
-
Next, you must have [Vagrant installed](http://docs.vagrantup.com/v2/installation/index.html). Vagrant-libvirt supports Vagrant 1.5 and 1.
|
34
|
+
Next, you must have [Vagrant installed](http://docs.vagrantup.com/v2/installation/index.html). Vagrant-libvirt supports Vagrant 1.5, 1.6 and 1.7.
|
35
35
|
|
36
36
|
Now you're ready to install vagrant-libvirt using standard [Vagrant plugin](http://docs.vagrantup.com/v2/plugins/usage.html) installation methods.
|
37
37
|
|
@@ -302,9 +302,7 @@ vagrant-libvirt supports vagrant's [standard ssh settings](https://docs.vagrantu
|
|
302
302
|
|
303
303
|
## Forwarded Ports
|
304
304
|
|
305
|
-
vagrant-libvirt supports Forwarded Ports via ssh port forwarding. For each
|
306
|
-
`forwarded_port` directive you specify in your Vagrantfile, vagrant-libvirt
|
307
|
-
will maintain an active ssh process for the lifetime of the VM.
|
305
|
+
vagrant-libvirt supports Forwarded Ports via ssh port forwarding. Please note that due to a well known limitation only the TCP protocol is supported. For each `forwarded_port` directive you specify in your Vagrantfile, vagrant-libvirt will maintain an active ssh process for the lifetime of the VM.
|
308
306
|
|
309
307
|
vagrant-libvirt supports an additional `forwarded_port` option
|
310
308
|
`gateway_ports` which defaults to `false`, but can be set to `true` if
|
data/Rakefile
CHANGED
data/example_box/Vagrantfile
CHANGED
@@ -21,11 +21,10 @@ Vagrant.configure("2") do |config|
|
|
21
21
|
|
22
22
|
# Interfaces for VM
|
23
23
|
#
|
24
|
-
# Networking features in the form of `config.vm.network`
|
25
|
-
# networks concept. No public network or port forwarding are supported in
|
26
|
-
# current version of provider. See README for more info.
|
24
|
+
# Networking features in the form of `config.vm.network`
|
27
25
|
#
|
28
26
|
#test_vm.vm.network :private_network, :ip => '10.20.30.40'
|
27
|
+
#test_vm.vm.network :public_network, :ip => '10.20.30.41'
|
29
28
|
#end
|
30
29
|
|
31
30
|
# Options for libvirt vagrant provider.
|
@@ -30,7 +30,7 @@ module VagrantPlugins
|
|
30
30
|
|
31
31
|
# Setup command for retrieving IP address for newly created machine
|
32
32
|
# with some MAC address. Get it from dnsmasq leases table
|
33
|
-
ip_command = %q[
|
33
|
+
ip_command = %q[ awk "/$mac/ {print \$1}" /proc/net/arp ]
|
34
34
|
conn_attr[:libvirt_ip_command] = ip_command
|
35
35
|
|
36
36
|
@logger.info("Connecting to Libvirt (#{uri}) ...")
|
@@ -26,11 +26,11 @@ module VagrantPlugins
|
|
26
26
|
|
27
27
|
# Gather some info about domain
|
28
28
|
@name = env[:domain_name]
|
29
|
-
@cpus = config.cpus
|
29
|
+
@cpus = config.cpus.to_i
|
30
30
|
@cpu_mode = config.cpu_mode
|
31
31
|
@disk_bus = config.disk_bus
|
32
32
|
@nested = config.nested
|
33
|
-
@memory_size = config.memory*1024
|
33
|
+
@memory_size = config.memory.to_i*1024
|
34
34
|
@domain_volume_cache = config.volume_cache
|
35
35
|
@kernel = config.kernel
|
36
36
|
@cmd_line = config.cmd_line
|
@@ -114,7 +114,8 @@ module VagrantPlugins
|
|
114
114
|
@logger.debug "Configuring interface slot_number #{slot_number} options #{options}"
|
115
115
|
|
116
116
|
network = {
|
117
|
-
:interface
|
117
|
+
:interface => slot_number,
|
118
|
+
:use_dhcp_assigned_default_route => options[:use_dhcp_assigned_default_route],
|
118
119
|
#:mac => ...,
|
119
120
|
}
|
120
121
|
|
@@ -4,6 +4,9 @@ module VagrantPlugins
|
|
4
4
|
module ProviderLibvirt
|
5
5
|
module Action
|
6
6
|
class HandleBoxImage
|
7
|
+
|
8
|
+
@@lock = Mutex.new
|
9
|
+
|
7
10
|
def initialize(app, env)
|
8
11
|
@logger = Log4r::Logger.new('vagrant_libvirt::action::handle_box_image')
|
9
12
|
@app = app
|
@@ -34,49 +37,51 @@ module VagrantPlugins
|
|
34
37
|
env[:box_volume_name] = env[:machine].box.name.to_s.dup.gsub("/", "-VAGRANTSLASH-")
|
35
38
|
env[:box_volume_name] << '_vagrant_box_image.img'
|
36
39
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
# Box is not available as a storage pool volume. Create and upload
|
42
|
-
# it as a copy of local box image.
|
43
|
-
env[:ui].info(I18n.t('vagrant_libvirt.uploading_volume'))
|
40
|
+
@@lock.synchronize do
|
41
|
+
# Don't continue if image already exists in storage pool.
|
42
|
+
return @app.call(env) if ProviderLibvirt::Util::Collection.find_matching(
|
43
|
+
env[:libvirt_compute].volumes.all, env[:box_volume_name])
|
44
44
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
message << " in storage pool #{config.storage_pool_name}."
|
49
|
-
@logger.info(message)
|
50
|
-
begin
|
51
|
-
fog_volume = env[:libvirt_compute].volumes.create(
|
52
|
-
name: env[:box_volume_name],
|
53
|
-
allocation: "#{box_image_size/1024/1024}M",
|
54
|
-
capacity: "#{box_virtual_size}G",
|
55
|
-
format_type: box_format,
|
56
|
-
pool_name: config.storage_pool_name)
|
57
|
-
rescue Fog::Errors::Error => e
|
58
|
-
raise Errors::FogCreateVolumeError,
|
59
|
-
:error_message => e.message
|
60
|
-
end
|
45
|
+
# Box is not available as a storage pool volume. Create and upload
|
46
|
+
# it as a copy of local box image.
|
47
|
+
env[:ui].info(I18n.t('vagrant_libvirt.uploading_volume'))
|
61
48
|
|
62
|
-
|
63
|
-
|
64
|
-
env[:box_volume_name]
|
65
|
-
|
66
|
-
|
67
|
-
|
49
|
+
# Create new volume in storage pool
|
50
|
+
box_image_size = File.size(box_image_file) # B
|
51
|
+
message = "Creating volume #{env[:box_volume_name]}"
|
52
|
+
message << " in storage pool #{config.storage_pool_name}."
|
53
|
+
@logger.info(message)
|
54
|
+
begin
|
55
|
+
fog_volume = env[:libvirt_compute].volumes.create(
|
56
|
+
name: env[:box_volume_name],
|
57
|
+
allocation: "#{box_image_size/1024/1024}M",
|
58
|
+
capacity: "#{box_virtual_size}G",
|
59
|
+
format_type: box_format,
|
60
|
+
pool_name: config.storage_pool_name)
|
61
|
+
rescue Fog::Errors::Error => e
|
62
|
+
raise Errors::FogCreateVolumeError,
|
63
|
+
:error_message => e.message
|
64
|
+
end
|
68
65
|
|
69
|
-
|
70
|
-
|
71
|
-
|
66
|
+
# Upload box image to storage pool
|
67
|
+
ret = upload_image(box_image_file, config.storage_pool_name,
|
68
|
+
env[:box_volume_name], env) do |progress|
|
69
|
+
env[:ui].clear_line
|
70
|
+
env[:ui].report_progress(progress, box_image_size, false)
|
71
|
+
end
|
72
72
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
73
|
+
# Clear the line one last time since the progress meter doesn't
|
74
|
+
# disappear immediately.
|
75
|
+
env[:ui].clear_line
|
76
|
+
|
77
|
+
# If upload failed or was interrupted, remove created volume from
|
78
|
+
# storage pool.
|
79
|
+
if env[:interrupted] || !ret
|
80
|
+
begin
|
81
|
+
fog_volume.destroy
|
82
|
+
rescue
|
83
|
+
nil
|
84
|
+
end
|
80
85
|
end
|
81
86
|
end
|
82
87
|
|
@@ -6,38 +6,44 @@ module VagrantPlugins
|
|
6
6
|
class HandleStoragePool
|
7
7
|
include VagrantPlugins::ProviderLibvirt::Util::ErbTemplate
|
8
8
|
|
9
|
+
@@lock = Mutex.new
|
10
|
+
|
9
11
|
def initialize(app, env)
|
10
12
|
@logger = Log4r::Logger.new("vagrant_libvirt::action::handle_storage_pool")
|
11
13
|
@app = app
|
12
14
|
end
|
13
15
|
|
14
16
|
def call(env)
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
17
|
+
@@lock.synchronize do
|
18
|
+
# Get config options.
|
19
|
+
config = env[:machine].provider_config
|
20
|
+
|
21
|
+
# Check for storage pool, where box image should be created
|
22
|
+
fog_pool = ProviderLibvirt::Util::Collection.find_matching(
|
23
|
+
env[:libvirt_compute].pools.all, config.storage_pool_name)
|
24
|
+
return @app.call(env) if fog_pool
|
25
|
+
|
26
|
+
@logger.info("No storage pool '#{config.storage_pool_name}' is available.")
|
27
|
+
|
28
|
+
# If user specified other pool than default, don't create default
|
29
|
+
# storage pool, just write error message.
|
30
|
+
raise Errors::NoStoragePool if config.storage_pool_name != 'default'
|
31
|
+
|
32
|
+
@logger.info("Creating storage pool 'default'")
|
33
|
+
|
34
|
+
# Fog libvirt currently doesn't support creating pools. Use
|
35
|
+
# ruby-libvirt client directly.
|
36
|
+
begin
|
37
|
+
libvirt_pool = env[:libvirt_compute].client.define_storage_pool_xml(
|
38
|
+
to_xml('default_storage_pool'))
|
39
|
+
libvirt_pool.build
|
40
|
+
libvirt_pool.create
|
41
|
+
rescue => e
|
42
|
+
raise Errors::CreatingStoragePoolError,
|
43
|
+
:error_message => e.message
|
44
|
+
end
|
45
|
+
raise Errors::NoStoragePool if !libvirt_pool
|
39
46
|
end
|
40
|
-
raise Errors::NoStoragePool if !libvirt_pool
|
41
47
|
|
42
48
|
@app.call(env)
|
43
49
|
end
|
data/vagrant-libvirt.gemspec
CHANGED
@@ -5,8 +5,8 @@ Gem::Specification.new do |gem|
|
|
5
5
|
gem.authors = ['Lukas Stanek','Dima Vasilets','Brian Pitts']
|
6
6
|
gem.email = ['ls@elostech.cz','pronix.service@gmail.com','brian@polibyte.com']
|
7
7
|
gem.license = 'MIT'
|
8
|
-
gem.description = %q{
|
9
|
-
gem.summary = %q{
|
8
|
+
gem.description = %q{libvirt provider for Vagrant.}
|
9
|
+
gem.summary = %q{libvirt provider for Vagrant.}
|
10
10
|
gem.homepage = 'https://github.com/pradels/vagrant-libvirt'
|
11
11
|
|
12
12
|
gem.files = `git ls-files`.split($\)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-libvirt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.25
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lukas Stanek
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2015-03-04 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rspec-core
|
@@ -110,7 +110,7 @@ dependencies:
|
|
110
110
|
- - ">="
|
111
111
|
- !ruby/object:Gem::Version
|
112
112
|
version: '0'
|
113
|
-
description:
|
113
|
+
description: libvirt provider for Vagrant.
|
114
114
|
email:
|
115
115
|
- ls@elostech.cz
|
116
116
|
- pronix.service@gmail.com
|
@@ -205,12 +205,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
205
205
|
version: '0'
|
206
206
|
requirements: []
|
207
207
|
rubyforge_project:
|
208
|
-
rubygems_version: 2.2.
|
208
|
+
rubygems_version: 2.2.0
|
209
209
|
signing_key:
|
210
210
|
specification_version: 4
|
211
|
-
summary:
|
211
|
+
summary: libvirt provider for Vagrant.
|
212
212
|
test_files:
|
213
213
|
- spec/spec_helper.rb
|
214
214
|
- spec/support/environment_helper.rb
|
215
215
|
- spec/vagrant-libvirt/action/set_name_of_domain_spec.rb
|
216
|
-
has_rdoc:
|