kitchen-qemu 0.2.4 → 0.2.5
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 +33 -14
- 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: cb38771a7b4755414d61c8766b9503fc79cce395
|
4
|
+
data.tar.gz: 6aec6dcc6dabcb1b6dfaaf4b9ab39c9a50aa4f47
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5ab29a56d741c00fb0bbfc41eaf470a0274bc5a33df3d70ff891e563a044fb31e40c7efc88f5b84737d792f3930de3370f64639b54ae95dd2302fc3419243568
|
7
|
+
data.tar.gz: 49f495ef2d79e9b53106a217c475a19808b5fd1f405af98bcb14647892ecb7bcf106119a8802ebb739776be3f147ddbfeb17e436fa00a578a92618e174c97914
|
data/lib/kitchen/driver/qemu.rb
CHANGED
@@ -77,27 +77,34 @@ module Kitchen
|
|
77
77
|
end
|
78
78
|
|
79
79
|
# kitchen-vagrant compatibility
|
80
|
-
config[:hostname] = config[:vm_hostname]
|
80
|
+
config[:hostname] = config[:vm_hostname] unless config.has_key?(:hostname)
|
81
81
|
|
82
82
|
acpi_poweroff = false
|
83
83
|
if config[:image].kind_of?(String)
|
84
84
|
config[:image] = [{
|
85
85
|
:file => config[:image],
|
86
|
-
:
|
87
|
-
:snapshot => true,
|
86
|
+
:snapshot => 'on',
|
88
87
|
}]
|
89
88
|
else
|
90
89
|
raise UserError, "Invalid image entry for #{instance.to_str}" unless
|
91
90
|
config[:image].kind_of?(Array)
|
92
91
|
config[:image].each do |image|
|
93
92
|
raise UserError, "Invalid image entry for #{instance.to_str}" unless
|
94
|
-
image.kind_of?(Hash) && image[:file]
|
95
|
-
|
96
|
-
image[:
|
97
|
-
|
93
|
+
image.kind_of?(Hash) && image[:file].kind_of?(String)
|
94
|
+
# backwards compatibility
|
95
|
+
image[:readonly] = 'on' if image[:readonly].kind_of?(TrueClass)
|
96
|
+
image[:readonly] = 'off' if image[:readonly].kind_of?(FalseClass)
|
97
|
+
image[:snapshot] = 'on' if image[:snapshot].kind_of?(TrueClass)
|
98
|
+
image[:snapshot] = 'off' if image[:snapshot].kind_of?(FalseClass)
|
99
|
+
# defaults
|
100
|
+
image[:snapshot] = 'on' if !image.has_key?(:snapshot) && image[:readonly] != 'on'
|
101
|
+
image[:discard] = 'unmap' if !image.has_key?(:discard) && image[:readonly] != 'on'
|
102
|
+
image[:detect_zeroes] = 'unmap' if !image.has_key?(:detect_zeroes) &&
|
103
|
+
image[:readonly] != 'on' && image[:snapshot] != 'on'
|
104
|
+
acpi_poweroff = true if image[:snapshot] != 'on' && image[:readonly] != 'on'
|
98
105
|
end
|
99
106
|
end
|
100
|
-
config[:acpi_poweroff] = acpi_poweroff
|
107
|
+
config[:acpi_poweroff] = acpi_poweroff unless config.has_key?(:acpi_poweroff)
|
101
108
|
|
102
109
|
raise UserError, "Invalid share entry for #{instance.to_str}" unless
|
103
110
|
config[:hostshares].kind_of?(Array)
|
@@ -113,11 +120,11 @@ module Kitchen
|
|
113
120
|
else
|
114
121
|
config[:hostshares].each do |share|
|
115
122
|
raise UserError, "Invalid share entry for #{instance.to_str}" unless
|
116
|
-
share.kind_of?(Hash) && share[:path]
|
123
|
+
share.kind_of?(Hash) && share[:path].kind_of?(String)
|
117
124
|
raise UserError, "No mountpoint defined for share '#{share[:path]}' of #{instance.to_str}" unless
|
118
|
-
share[:mountpoint]
|
119
|
-
raise UserError, "Invalid mount options for share '#{share[:path]}' of #{instance.to_str}"
|
120
|
-
share
|
125
|
+
share[:mountpoint].kind_of?(String)
|
126
|
+
raise UserError, "Invalid mount options for share '#{share[:path]}' of #{instance.to_str}" if
|
127
|
+
share.has_key?(:mount_options) && !share[:mount_options].kind_of?(Array)
|
121
128
|
end
|
122
129
|
end
|
123
130
|
|
@@ -185,8 +192,10 @@ module Kitchen
|
|
185
192
|
cmd.push('-device', 'virtio-scsi-pci,id=scsi')
|
186
193
|
config[:image].each_with_index do |image, i|
|
187
194
|
drive = ['if=none', "id=drive#{i}"]
|
188
|
-
drive.push(
|
189
|
-
drive.push(
|
195
|
+
drive.push("readonly=#{image[:readonly]}") if image.has_key?(:readonly)
|
196
|
+
drive.push("snapshot=#{image[:snapshot]}") if image.has_key?(:snapshot)
|
197
|
+
drive.push("discard=#{image[:discard]}") if image.has_key?(:discard)
|
198
|
+
drive.push("detect-zeroes=#{image[:detect_zeroes]}") if image.has_key?(:detect_zeroes)
|
190
199
|
if image[:file][0] == '/'
|
191
200
|
drive.push("file=#{image[:file]}")
|
192
201
|
else
|
@@ -196,6 +205,16 @@ module Kitchen
|
|
196
205
|
'-drive', drive.join(','))
|
197
206
|
end
|
198
207
|
|
208
|
+
smp = []
|
209
|
+
smp.push("cpus=#{config[:cpus]}") if config.has_key?(:cpus)
|
210
|
+
smp.push("sockets=#{config[:sockets]}") if config.has_key?(:sockets)
|
211
|
+
smp.push("cores=#{config[:cores]}") if config.has_key?(:cores)
|
212
|
+
smp.push("threads=#{config[:threads]}") if config.has_key?(:threads)
|
213
|
+
if smp.length > 0
|
214
|
+
info 'SMP enabled.'
|
215
|
+
cmd.push('-smp', smp.join(','))
|
216
|
+
end
|
217
|
+
|
199
218
|
config[:hostshares].each_with_index do |share, i|
|
200
219
|
path = share[:path]
|
201
220
|
path = "#{config[:kitchen_root]}/#{path}" unless path[0] == '/'
|
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.5
|
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-
|
11
|
+
date: 2016-09-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: test-kitchen
|