kitchen-qemu 0.2.5 → 0.2.6
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/lib/kitchen/driver/qemu.rb +30 -8
- data/lib/kitchen/driver/qemu_version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8dd24ef6c0204e58e644cca85f42a7bec9e0fc75
|
4
|
+
data.tar.gz: 4840059137e31c53f4327582b39c6cb173d767ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af40db104231ae9fc40c536adf0041b7a4209c8105b344bcc7d54917b6eaf4120443056ab0279ffcd17bd80be6f1d6a452b9e31dfbba90f0227720248b34c8cb
|
7
|
+
data.tar.gz: c5abe718f9d579b699cc2deaa38beb0ec2f46d9426395d185bca3b207aca3226b22c7f83ee5411c38ba8ece4542e533120f1f781c5f20972b1397f0fb46183fa
|
data/lib/kitchen/driver/qemu.rb
CHANGED
@@ -41,7 +41,6 @@ module Kitchen
|
|
41
41
|
default_config :port_max, 65535
|
42
42
|
default_config :display, 'none'
|
43
43
|
default_config :memory, '512'
|
44
|
-
default_config :nic_model, 'virtio'
|
45
44
|
default_config :hostshares, []
|
46
45
|
|
47
46
|
default_config :image_path do |_|
|
@@ -79,6 +78,24 @@ module Kitchen
|
|
79
78
|
# kitchen-vagrant compatibility
|
80
79
|
config[:hostname] = config[:vm_hostname] unless config.has_key?(:hostname)
|
81
80
|
|
81
|
+
# add default network
|
82
|
+
if !config.has_key?(:networks)
|
83
|
+
config[:networks] = [{
|
84
|
+
:netdev => 'user,id=user,net=192.168.1.0/24,hostname=%h,hostfwd=tcp::%p-:22',
|
85
|
+
:device => 'virtio-net-pci,netdev=user',
|
86
|
+
}]
|
87
|
+
else
|
88
|
+
raise UserError, "Invalid network entry for #{instance.to_str}" unless
|
89
|
+
config[:networks].kind_of?(Array)
|
90
|
+
|
91
|
+
config[:networks].each_with_index do |network, i|
|
92
|
+
raise UserError, "Invalid network entry #{i+1} for #{instance.to_str}" unless
|
93
|
+
network.kind_of?(Hash) && network[:device].kind_of?(String)
|
94
|
+
raise UserError, "Invalid network entry #{i+1} for #{instance.to_str}" if
|
95
|
+
network.has_key?(:device) && !network[:device].kind_of?(String)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
82
99
|
acpi_poweroff = false
|
83
100
|
if config[:image].kind_of?(String)
|
84
101
|
config[:image] = [{
|
@@ -185,6 +202,18 @@ module Kitchen
|
|
185
202
|
info 'KVM disabled'
|
186
203
|
end
|
187
204
|
|
205
|
+
port = config[:port]
|
206
|
+
port = random_free_port('127.0.0.1', config[:port_min], config[:port_max]) if port.nil?
|
207
|
+
config[:networks].each do |network|
|
208
|
+
cmd.push(
|
209
|
+
'-netdev',
|
210
|
+
network[:netdev]
|
211
|
+
.gsub(/hostfwd=[^,]*/) { |x| x.gsub('%p', port.to_s) }
|
212
|
+
.gsub(/hostname=%h/, "hostname=#{hostname}")
|
213
|
+
) if network[:netdev]
|
214
|
+
cmd.push('-device', network[:device])
|
215
|
+
end
|
216
|
+
|
188
217
|
cmd.push('-vga', config[:vga].to_s) if config[:vga]
|
189
218
|
cmd.push('-spice', config[:spice].to_s) if config[:spice]
|
190
219
|
cmd.push('-vnc', config[:vnc].to_s) if config[:vnc]
|
@@ -224,13 +253,6 @@ module Kitchen
|
|
224
253
|
'-device', "virtio-9p-pci,fsdev=fsdev#{i},mount_tag=path#{i}")
|
225
254
|
end
|
226
255
|
|
227
|
-
port = config[:port]
|
228
|
-
port = random_free_port('127.0.0.1', config[:port_min], config[:port_max]) if port.nil?
|
229
|
-
cmd.push(
|
230
|
-
'-net', "nic,model=#{config[:nic_model]}",
|
231
|
-
'-net', "user,net=192.168.1.0/24,hostname=#{hostname},hostfwd=tcp::#{port}-:22",
|
232
|
-
)
|
233
|
-
|
234
256
|
info 'Spawning QEMU..'
|
235
257
|
error = nil
|
236
258
|
Open3.popen3({ 'QEMU_AUDIO_DRV' => 'none' }, *cmd) do |_, _, err, thr|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kitchen-qemu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Emil Renner Berthing
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-09
|
11
|
+
date: 2016-11-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: test-kitchen
|