199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
|
# File 'manifests/compute/libvirt.pp', line 199
class nova::compute::libvirt (
$ensure_package = 'present',
$libvirt_virt_type = 'kvm',
$vncserver_listen = '127.0.0.1',
$migration_support = false,
$libvirt_cpu_mode = false,
$libvirt_cpu_model = undef,
$libvirt_cpu_model_extra_flags = undef,
$libvirt_snapshot_image_format = $::os_service_default,
$libvirt_disk_cachemodes = [],
$libvirt_hw_disk_discard = $::os_service_default,
$libvirt_hw_machine_type = $::os_service_default,
$libvirt_inject_password = false,
$libvirt_inject_key = false,
$libvirt_inject_partition = -2,
$libvirt_enabled_perf_events = $::os_service_default,
$remove_unused_base_images = undef,
$remove_unused_resized_minimum_age_seconds = undef,
$remove_unused_original_minimum_age_seconds = undef,
$libvirt_service_name = $::nova::params::libvirt_service_name,
$virtlock_service_name = $::nova::params::virtlock_service_name,
$virtlog_service_name = $::nova::params::virtlog_service_name,
$compute_driver = 'libvirt.LibvirtDriver',
$preallocate_images = $::os_service_default,
$manage_libvirt_services = true,
$log_outputs = undef,
$rx_queue_size = $::os_service_default,
$tx_queue_size = $::os_service_default,
$file_backed_memory = undef,
$volume_use_multipath = $::os_service_default,
$nfs_mount_options = $::os_service_default,
$num_pcie_ports = $::os_service_default,
$mem_stats_period_seconds = $::os_service_default,
$log_filters = undef,
$tls_priority = undef,
$pmem_namespaces = $::os_service_default,
) inherits nova::params {
include nova::deps
include nova::params
# libvirt_cpu_mode has different defaults depending on hypervisor.
if !$libvirt_cpu_mode {
case $libvirt_virt_type {
'kvm': {
$libvirt_cpu_mode_real = 'host-model'
}
default: {
$libvirt_cpu_mode_real = 'none'
}
}
} else {
$libvirt_cpu_mode_real = $libvirt_cpu_mode
}
if($::osfamily == 'Debian') {
package { "nova-compute-${libvirt_virt_type}":
ensure => $ensure_package,
tag => ['openstack', 'nova-package'],
}
}
if $migration_support {
include nova::migration::libvirt
}
if $log_outputs {
libvirtd_config {
'log_outputs': value => "\"${log_outputs}\"";
}
} else {
libvirtd_config {
'log_outputs': ensure => 'absent';
}
}
if $log_filters {
libvirtd_config {
'log_filters': value => "\"${log_filters}\"";
}
} else {
libvirtd_config {
'log_filters': ensure => 'absent';
}
}
if $tls_priority {
libvirtd_config {
'tls_priority': value => "\"${tls_priority}\"";
}
} else {
libvirtd_config {
'tls_priority': ensure => 'absent';
}
}
unless $rx_queue_size == $::os_service_default or $rx_queue_size in [256, 512, 1024] {
fail("Invalid rx_queue_size parameter: ${rx_queue_size}")
}
unless $tx_queue_size == $::os_service_default or $tx_queue_size in [256, 512, 1024] {
fail("Invalid_tx_queue_size parameter: ${tx_queue_size}")
}
# manage_libvirt_services is here for backward compatibility to support
# deployments that do not include nova::compute::libvirt::services
#
# If you're using hiera:
# - set nova::compute::libvirt::manage_libvirt_services to false
# - include nova::compute::libvirt::services in your composition layer
# - select which services you want to deploy with
# ::nova::compute::libvirt::services:* parameters.
#
# If you're not using hiera:
# - set nova::compute::libvirt::manage_libvirt_services to true (default).
# - select which services you want to deploy with
# ::nova::compute::libvirt::*_service_name parameters.
if $manage_libvirt_services {
class { 'nova::compute::libvirt::services':
libvirt_service_name => $libvirt_service_name,
virtlock_service_name => $virtlock_service_name,
virtlog_service_name => $virtlog_service_name,
libvirt_virt_type => $libvirt_virt_type,
}
}
nova_config {
'DEFAULT/compute_driver': value => $compute_driver;
'DEFAULT/preallocate_images': value => $preallocate_images;
'vnc/server_listen': value => $vncserver_listen;
'libvirt/virt_type': value => $libvirt_virt_type;
'libvirt/cpu_mode': value => $libvirt_cpu_mode_real;
'libvirt/snapshot_image_format': value => $libvirt_snapshot_image_format;
'libvirt/inject_password': value => $libvirt_inject_password;
'libvirt/inject_key': value => $libvirt_inject_key;
'libvirt/inject_partition': value => $libvirt_inject_partition;
'libvirt/hw_disk_discard': value => $libvirt_hw_disk_discard;
'libvirt/hw_machine_type': value => $libvirt_hw_machine_type;
'libvirt/enabled_perf_events': value => join(any2array($libvirt_enabled_perf_events), ',');
'libvirt/rx_queue_size': value => $rx_queue_size;
'libvirt/tx_queue_size': value => $tx_queue_size;
'libvirt/file_backed_memory': value => $file_backed_memory;
'libvirt/volume_use_multipath': value => $volume_use_multipath;
'libvirt/nfs_mount_options': value => $nfs_mount_options;
'libvirt/num_pcie_ports': value => $num_pcie_ports;
'libvirt/mem_stats_period_seconds': value => $mem_stats_period_seconds;
'libvirt/pmem_namespaces': value => $pmem_namespaces;
}
# cpu_model param is only valid if cpu_mode=custom
# otherwise it should be commented out
if $libvirt_cpu_mode_real == 'custom' {
validate_legacy(String, 'validate_string', $libvirt_cpu_model)
nova_config {
'libvirt/cpu_model': value => $libvirt_cpu_model;
}
} else {
nova_config {
'libvirt/cpu_model': ensure => absent;
}
if $libvirt_cpu_model {
warning('$libvirt_cpu_model requires that $libvirt_cpu_mode => "custom" and will be ignored')
}
}
if $libvirt_cpu_mode_real != 'none' {
validate_legacy(String, 'validate_string', $libvirt_cpu_model_extra_flags)
nova_config {
'libvirt/cpu_model_extra_flags': value => $libvirt_cpu_model_extra_flags;
}
} else {
nova_config {
'libvirt/cpu_model_extra_flags': ensure => absent;
}
if $libvirt_cpu_model_extra_flags {
warning('$libvirt_cpu_model_extra_flags requires that $libvirt_cpu_mode is not set to "none" and will be ignored')
}
}
if size($libvirt_disk_cachemodes) > 0 {
nova_config {
'libvirt/disk_cachemodes': value => join($libvirt_disk_cachemodes, ',');
}
} else {
nova_config {
'libvirt/disk_cachemodes': ensure => absent;
}
}
if $remove_unused_resized_minimum_age_seconds != undef {
nova_config {
'libvirt/remove_unused_resized_minimum_age_seconds': value => $remove_unused_resized_minimum_age_seconds;
}
} else {
nova_config {
'libvirt/remove_unused_resized_minimum_age_seconds': ensure => absent;
}
}
if $remove_unused_base_images != undef {
nova_config {
'DEFAULT/remove_unused_base_images': value => $remove_unused_base_images;
}
} else {
nova_config {
'DEFAULT/remove_unused_base_images': ensure => absent;
}
}
if $remove_unused_original_minimum_age_seconds != undef {
nova_config {
'DEFAULT/remove_unused_original_minimum_age_seconds': value => $remove_unused_original_minimum_age_seconds;
}
} else {
nova_config {
'DEFAULT/remove_unused_original_minimum_age_seconds': ensure => absent;
}
}
}
|