vagrant-libvirt 0.0.23 → 0.0.24
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -1
- data/lib/vagrant-libvirt.rb +0 -10
- data/lib/vagrant-libvirt/action/create_domain.rb +12 -7
- data/lib/vagrant-libvirt/action/create_network_interfaces.rb +1 -0
- data/lib/vagrant-libvirt/action/forward_ports.rb +16 -2
- data/lib/vagrant-libvirt/action/prepare_nfs_settings.rb +1 -1
- data/lib/vagrant-libvirt/config.rb +13 -2
- data/lib/vagrant-libvirt/templates/domain.xml.erb +3 -3
- data/lib/vagrant-libvirt/templates/public_interface.xml.erb +5 -4
- data/lib/vagrant-libvirt/version.rb +1 -1
- data/vagrant-libvirt.gemspec +7 -7
- metadata +20 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 67a89ffdbbe10d25e43c0029df99b9755cc32480
|
4
|
+
data.tar.gz: 7fb86a0a3312d4fe0c1851486188cf90644015c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74f6ddbd5fb0f41421e43ada6671af768ec770ddf06125c961b5df6a3fd06c4585c53bd0f459612310f3ece6b2c587d2d860daa7d5a467043cbc12a3cc84a649
|
7
|
+
data.tar.gz: a0ba44421fabc6ba09ed061352b1cf9cadbc488094991d8326585d169b6eb574c932d11a5721b38fe978dad0c06cd5191cec38fffae7a6b3f7710b8e0be2d527
|
data/README.md
CHANGED
@@ -155,7 +155,7 @@ end
|
|
155
155
|
* `graphics_port` - Sets the port for the display protocol to bind to. Defaults to 5900.
|
156
156
|
* `graphics_ip` - Sets the IP for the display protocol to bind to. Defaults to "127.0.0.0.1".
|
157
157
|
* `graphics_passwd` - Sets the password for the display protocol. Working for vnc and spice. by default working without passsword.
|
158
|
-
* `video_type` - Sets the graphics card type exposed to the guest. Defaults to "cirrus". Possible values are "
|
158
|
+
* `video_type` - Sets the graphics card type exposed to the guest. Defaults to "cirrus". [Possible values](http://libvirt.org/formatdomain.html#elementsVideo) are "vga", "cirrus", "vmvga", "xen", "vbox", or "qxl".
|
159
159
|
* `video_vram` - Used by some graphics card types to vary the amount of RAM dedicated to video. Defaults to 9216.
|
160
160
|
|
161
161
|
|
@@ -253,6 +253,7 @@ starts with 'libvirt__' string. Here is a list of those options:
|
|
253
253
|
modes are available from the [libvirt documentation](http://www.libvirt.org/formatdomain.html#elementsNICSDirect).
|
254
254
|
Default mode is 'bridge'.
|
255
255
|
* `:mac` - MAC address for the interface.
|
256
|
+
* `:ovs` - Support to connect to an open vSwitch bridge device. Default is 'false'.
|
256
257
|
|
257
258
|
### Management Network
|
258
259
|
|
@@ -281,6 +282,8 @@ You can create and attach additional disks to a VM via `libvirt.storage :file`.
|
|
281
282
|
* `device` - Name of the device node the disk image will have in the VM, e.g. *vdb*. If unspecified, the next available device is chosen.
|
282
283
|
* `size` - Size of the disk image. If unspecified, defaults to 10G.
|
283
284
|
* `type` - Type of disk image to create. Defaults to *qcow2*.
|
285
|
+
* `bus` - Type of bus to connect device to. Defaults to *virtio*.
|
286
|
+
* `cache` - Cache mode to use, e.g. `none`, `writeback`, `writethrough` (see the [libvirt documentation for possible values](http://libvirt.org/formatdomain.html#elementsDisks) or [here](https://www.suse.com/documentation/sles11/book_kvm/data/sect1_chapter_book_kvm.html) for a fuller explanation). Defaults to *default*.
|
284
287
|
|
285
288
|
The following example creates two additional disks.
|
286
289
|
|
data/lib/vagrant-libvirt.rb
CHANGED
@@ -27,13 +27,3 @@ module VagrantPlugins
|
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
30
|
-
|
31
|
-
# set provider by bash env
|
32
|
-
# export VAGRANT_DEFAULT_PROVIDER=libvirt
|
33
|
-
Vagrant::Environment.class_eval do
|
34
|
-
def default_provider
|
35
|
-
(ENV['VAGRANT_DEFAULT_PROVIDER'] || :virtualbox).to_sym
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
|
@@ -66,19 +66,24 @@ module VagrantPlugins
|
|
66
66
|
storage_prefix = File.dirname(@domain_volume_path)+'/' # steal
|
67
67
|
|
68
68
|
@disks.each do |disk|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
69
|
+
|
70
|
+
disk[:path] ||= _disk_name(@name, disk)
|
71
|
+
|
72
|
+
# On volume creation, the <path> element inside <target>
|
73
|
+
# is oddly ignored; instead the path is taken from the
|
74
|
+
# <name> element:
|
75
|
+
# http://www.redhat.com/archives/libvir-list/2008-August/msg00329.html
|
76
|
+
disk[:name] = disk[:path]
|
77
|
+
|
78
|
+
disk[:absolute_path] = storage_prefix + disk[:path]
|
73
79
|
|
74
80
|
# make the disk. equivalent to:
|
75
81
|
# qemu-img create -f qcow2 <path> 5g
|
76
82
|
begin
|
77
|
-
#puts "Making disk: #{d}, #{t}, #{p}"
|
78
83
|
domain_volume_disk = env[:libvirt_compute].volumes.create(
|
79
84
|
:name => disk[:name],
|
80
85
|
:format_type => disk[:type],
|
81
|
-
:path => disk[:
|
86
|
+
:path => disk[:absolute_path],
|
82
87
|
:capacity => disk[:size],
|
83
88
|
#:allocation => ?,
|
84
89
|
:pool_name => @storage_pool_name)
|
@@ -111,7 +116,7 @@ module VagrantPlugins
|
|
111
116
|
env[:ui].info(" -- Disks: #{_disks_print(@disks)}")
|
112
117
|
end
|
113
118
|
@disks.each do |disk|
|
114
|
-
env[:ui].info(" -- Disk(#{disk[:device]}): #{disk[:
|
119
|
+
env[:ui].info(" -- Disk(#{disk[:device]}): #{disk[:absolute_path]}")
|
115
120
|
end
|
116
121
|
env[:ui].info(" -- Command line : #{@cmd_line}")
|
117
122
|
|
@@ -79,6 +79,7 @@ module VagrantPlugins
|
|
79
79
|
@model_type = iface_configuration.fetch(:model_type, @nic_model_type)
|
80
80
|
template_name = 'public_interface'
|
81
81
|
@logger.info("Setting up public interface using device #{@device} in mode #{@mode}")
|
82
|
+
@ovs = iface_configuration.fetch(:ovs, false)
|
82
83
|
end
|
83
84
|
|
84
85
|
message = "Creating network interface eth#{@iface_number}"
|
@@ -83,7 +83,8 @@ module VagrantPlugins
|
|
83
83
|
gateway_ports)
|
84
84
|
ssh_info = machine.ssh_info
|
85
85
|
params = %W(
|
86
|
-
|
86
|
+
-L
|
87
|
+
#{host_ip}:#{host_port}:#{guest_ip}:#{guest_port}
|
87
88
|
-N
|
88
89
|
#{ssh_info[:host]}
|
89
90
|
).join(' ')
|
@@ -118,7 +119,20 @@ module VagrantPlugins
|
|
118
119
|
ssh_cmd << "ssh #{options} #{params}"
|
119
120
|
|
120
121
|
@logger.debug "Forwarding port with `#{ssh_cmd}`"
|
121
|
-
|
122
|
+
log_file = ssh_forward_log_file(host_ip, host_port,
|
123
|
+
guest_ip, guest_port)
|
124
|
+
@logger.info "Logging to #{log_file}"
|
125
|
+
spawn(ssh_cmd, [:out, :err] => [log_file, 'w'])
|
126
|
+
end
|
127
|
+
|
128
|
+
def ssh_forward_log_file(host_ip, host_port, guest_ip, guest_port)
|
129
|
+
log_dir = @env[:machine].data_dir.join('logs')
|
130
|
+
log_dir.mkdir unless log_dir.directory?
|
131
|
+
File.join(
|
132
|
+
log_dir,
|
133
|
+
'ssh-forwarding-%s_%s-%s_%s.log' %
|
134
|
+
[ host_ip, host_port, guest_ip, guest_port ]
|
135
|
+
)
|
122
136
|
end
|
123
137
|
|
124
138
|
def store_ssh_pid(host_port, ssh_pid)
|
@@ -44,7 +44,7 @@ module VagrantPlugins
|
|
44
44
|
domain = env[:libvirt_compute].servers.get(machine.id.to_s)
|
45
45
|
xml=Nokogiri::XML(domain.to_xml)
|
46
46
|
networkname = xml.xpath('/domain/devices/interface/source').first.attributes['network'].value.to_s
|
47
|
-
|
47
|
+
@logger.info("Using network named #{networkname}")
|
48
48
|
net = env[:libvirt_compute].list_networks.find {|netw| netw[:name] == networkname}
|
49
49
|
end
|
50
50
|
# FIXME better implement by libvirt xml parsing
|
@@ -131,11 +131,10 @@ module VagrantPlugins
|
|
131
131
|
:type => 'qcow2',
|
132
132
|
:size => '10G', # matches the fog default
|
133
133
|
:path => nil,
|
134
|
+
:bus => 'virtio'
|
134
135
|
}.merge(options)
|
135
136
|
|
136
137
|
#puts "storage(#{storage_type} --- #{options.to_s})"
|
137
|
-
require 'pry'
|
138
|
-
binding.pry
|
139
138
|
@disks = [] if @disks == UNSET_VALUE
|
140
139
|
|
141
140
|
disk = {
|
@@ -143,6 +142,8 @@ module VagrantPlugins
|
|
143
142
|
:type => options[:type],
|
144
143
|
:size => options[:size],
|
145
144
|
:path => options[:path],
|
145
|
+
:bus => options[:bus],
|
146
|
+
:cache => options[:cache] || 'default',
|
146
147
|
}
|
147
148
|
|
148
149
|
if storage_type == :file
|
@@ -242,7 +243,17 @@ module VagrantPlugins
|
|
242
243
|
end
|
243
244
|
|
244
245
|
def validate(machine)
|
246
|
+
errors = _detected_errors
|
247
|
+
|
248
|
+
machine.provider_config.disks.each do |disk|
|
249
|
+
if disk[:path] and disk[:path][0] == '/'
|
250
|
+
errors << "absolute volume paths like '#{disk[:path]}' not yet supported"
|
251
|
+
end
|
252
|
+
end
|
253
|
+
|
254
|
+
{ "Libvirt Provider" => errors }
|
245
255
|
end
|
256
|
+
|
246
257
|
end
|
247
258
|
end
|
248
259
|
end
|
@@ -36,9 +36,9 @@
|
|
36
36
|
<%# additional disks -%>
|
37
37
|
<% @disks.each do |d| -%>
|
38
38
|
<disk type='file' device='disk'>
|
39
|
-
<driver name='qemu' type='<%= d[:type] %>'/>
|
40
|
-
<source file='<%= d[:
|
41
|
-
<target dev='<%= d[:device] %>' bus='
|
39
|
+
<driver name='qemu' type='<%= d[:type] %>' cache='<%= d[:cache] %>'/>
|
40
|
+
<source file='<%= d[:absolute_path] %>'/>
|
41
|
+
<target dev='<%= d[:device] %>' bus='<%= d[:bus] %>'/>
|
42
42
|
<%# this will get auto generated by libvirt
|
43
43
|
<address type='pci' domain='0x0000' bus='0x00' slot='???' function='0x0'/>
|
44
44
|
-%>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<interface type='<%= @type %>'>
|
2
|
-
|
3
|
-
|
2
|
+
<% if @mac %>
|
3
|
+
<mac address='<%= @mac %>'/>
|
4
4
|
<% end %>
|
5
5
|
<%if @type == 'direct'%>
|
6
6
|
<source dev='<%= @device %>' mode='<%= @mode %>'/>
|
@@ -8,6 +8,7 @@
|
|
8
8
|
<source bridge='<%=@device%>'/>
|
9
9
|
<% end %>
|
10
10
|
<model type='<%=@model_type%>'/>
|
11
|
+
<% if @ovs %>
|
12
|
+
<virtualport type='openvswitch'/>
|
13
|
+
<% end %>
|
11
14
|
</interface>
|
12
|
-
|
13
|
-
|
data/vagrant-libvirt.gemspec
CHANGED
@@ -5,7 +5,7 @@ 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{Vagrant provider for libvirt.
|
8
|
+
gem.description = %q{Vagrant provider for libvirt.}
|
9
9
|
gem.summary = %q{Vagrant provider for libvirt.}
|
10
10
|
gem.homepage = 'https://github.com/pradels/vagrant-libvirt'
|
11
11
|
|
@@ -16,14 +16,14 @@ Gem::Specification.new do |gem|
|
|
16
16
|
gem.require_paths = ['lib']
|
17
17
|
gem.version = VagrantPlugins::ProviderLibvirt::VERSION
|
18
18
|
|
19
|
-
gem.add_development_dependency
|
20
|
-
gem.add_development_dependency
|
21
|
-
gem.add_development_dependency
|
19
|
+
gem.add_development_dependency "rspec-core", "~> 2.12.2"
|
20
|
+
gem.add_development_dependency "rspec-expectations", "~> 2.12.1"
|
21
|
+
gem.add_development_dependency "rspec-mocks", "~> 2.12.1"
|
22
22
|
|
23
|
-
gem.add_runtime_dependency 'fog', '1.15'
|
24
|
-
gem.add_runtime_dependency 'ruby-libvirt', '0.4
|
23
|
+
gem.add_runtime_dependency 'fog', '~> 1.15'
|
24
|
+
gem.add_runtime_dependency 'ruby-libvirt', '~> 0.4'
|
25
25
|
gem.add_runtime_dependency 'nokogiri', '~> 1.6.0'
|
26
26
|
|
27
|
-
gem.add_development_dependency 'rake'
|
27
|
+
gem.add_development_dependency 'rake'
|
28
28
|
end
|
29
29
|
|
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.24
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lukas Stanek
|
@@ -10,78 +10,78 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2014-
|
13
|
+
date: 2014-12-04 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rspec-core
|
17
17
|
requirement: !ruby/object:Gem::Requirement
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - "~>"
|
20
20
|
- !ruby/object:Gem::Version
|
21
21
|
version: 2.12.2
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
|
-
- -
|
26
|
+
- - "~>"
|
27
27
|
- !ruby/object:Gem::Version
|
28
28
|
version: 2.12.2
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: rspec-expectations
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
32
32
|
requirements:
|
33
|
-
- -
|
33
|
+
- - "~>"
|
34
34
|
- !ruby/object:Gem::Version
|
35
35
|
version: 2.12.1
|
36
36
|
type: :development
|
37
37
|
prerelease: false
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
|
-
- -
|
40
|
+
- - "~>"
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
version: 2.12.1
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
44
|
name: rspec-mocks
|
45
45
|
requirement: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
|
-
- -
|
47
|
+
- - "~>"
|
48
48
|
- !ruby/object:Gem::Version
|
49
49
|
version: 2.12.1
|
50
50
|
type: :development
|
51
51
|
prerelease: false
|
52
52
|
version_requirements: !ruby/object:Gem::Requirement
|
53
53
|
requirements:
|
54
|
-
- -
|
54
|
+
- - "~>"
|
55
55
|
- !ruby/object:Gem::Version
|
56
56
|
version: 2.12.1
|
57
57
|
- !ruby/object:Gem::Dependency
|
58
58
|
name: fog
|
59
59
|
requirement: !ruby/object:Gem::Requirement
|
60
60
|
requirements:
|
61
|
-
- -
|
61
|
+
- - "~>"
|
62
62
|
- !ruby/object:Gem::Version
|
63
63
|
version: '1.15'
|
64
64
|
type: :runtime
|
65
65
|
prerelease: false
|
66
66
|
version_requirements: !ruby/object:Gem::Requirement
|
67
67
|
requirements:
|
68
|
-
- -
|
68
|
+
- - "~>"
|
69
69
|
- !ruby/object:Gem::Version
|
70
70
|
version: '1.15'
|
71
71
|
- !ruby/object:Gem::Dependency
|
72
72
|
name: ruby-libvirt
|
73
73
|
requirement: !ruby/object:Gem::Requirement
|
74
74
|
requirements:
|
75
|
-
- -
|
75
|
+
- - "~>"
|
76
76
|
- !ruby/object:Gem::Version
|
77
|
-
version: 0.4
|
77
|
+
version: '0.4'
|
78
78
|
type: :runtime
|
79
79
|
prerelease: false
|
80
80
|
version_requirements: !ruby/object:Gem::Requirement
|
81
81
|
requirements:
|
82
|
-
- -
|
82
|
+
- - "~>"
|
83
83
|
- !ruby/object:Gem::Version
|
84
|
-
version: 0.4
|
84
|
+
version: '0.4'
|
85
85
|
- !ruby/object:Gem::Dependency
|
86
86
|
name: nokogiri
|
87
87
|
requirement: !ruby/object:Gem::Requirement
|
@@ -100,17 +100,17 @@ dependencies:
|
|
100
100
|
name: rake
|
101
101
|
requirement: !ruby/object:Gem::Requirement
|
102
102
|
requirements:
|
103
|
-
- -
|
103
|
+
- - ">="
|
104
104
|
- !ruby/object:Gem::Version
|
105
|
-
version:
|
105
|
+
version: '0'
|
106
106
|
type: :development
|
107
107
|
prerelease: false
|
108
108
|
version_requirements: !ruby/object:Gem::Requirement
|
109
109
|
requirements:
|
110
|
-
- -
|
110
|
+
- - ">="
|
111
111
|
- !ruby/object:Gem::Version
|
112
|
-
version:
|
113
|
-
description: Vagrant provider for libvirt.
|
112
|
+
version: '0'
|
113
|
+
description: Vagrant provider for libvirt.
|
114
114
|
email:
|
115
115
|
- ls@elostech.cz
|
116
116
|
- pronix.service@gmail.com
|
@@ -213,3 +213,4 @@ 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:
|