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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ba7790deddf9d9fb08c2641e8e697939986de0f6
4
- data.tar.gz: 5cacb0d0430844a839f60b40289731ae6ce4b309
3
+ metadata.gz: cb38771a7b4755414d61c8766b9503fc79cce395
4
+ data.tar.gz: 6aec6dcc6dabcb1b6dfaaf4b9ab39c9a50aa4f47
5
5
  SHA512:
6
- metadata.gz: 6b89c6e201ac6bd4bdc0537dfc1a368d2bb57c729ee9a37cc1b80e1d3e9dd96ee9c5b0c43dbb4d1a59726d7c14a348c4c542991aaeb3c365f776271488d3a901
7
- data.tar.gz: 9c156a6bdaf2827eb0676ae963b5470a3bbb5a2aeb4a1c6b967b7269e0b013655689e61237554dd842a113e76bee93ffeea11917e89d39aeb0ce0f65251a0008
6
+ metadata.gz: 5ab29a56d741c00fb0bbfc41eaf470a0274bc5a33df3d70ff891e563a044fb31e40c7efc88f5b84737d792f3930de3370f64639b54ae95dd2302fc3419243568
7
+ data.tar.gz: 49f495ef2d79e9b53106a217c475a19808b5fd1f405af98bcb14647892ecb7bcf106119a8802ebb739776be3f147ddbfeb17e436fa00a578a92618e174c97914
@@ -77,27 +77,34 @@ module Kitchen
77
77
  end
78
78
 
79
79
  # kitchen-vagrant compatibility
80
- config[:hostname] = config[:vm_hostname] if config[:hostname].nil?
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
- :readonly => false,
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
- image[:readonly] = false if image[:readonly].nil?
96
- image[:snapshot] = !image[:readonly] if image[:snapshot].nil?
97
- acpi_poweroff = true unless (image[:snapshot] || image[:readonly])
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 if config[:acpi_poweroff].nil?
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}" unless
120
- share[:mount_options].nil? || share[:mount_options].kind_of?(Array)
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('readonly') if image[:readonly]
189
- drive.push('snapshot=on') if image[:snapshot]
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] == '/'
@@ -17,6 +17,6 @@
17
17
  module Kitchen
18
18
  module Driver
19
19
  # Version string for the QEMU Kitchen driver
20
- QEMU_VERSION = '0.2.4'
20
+ QEMU_VERSION = '0.2.5'
21
21
  end
22
22
  end
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
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-08-30 00:00:00.000000000 Z
11
+ date: 2016-09-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test-kitchen