123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269 |
- 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_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,
- ) inherits nova::params {
- include ::nova::deps
- include ::nova::params
-
- 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 $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/vncserver_listen': value => $vncserver_listen;
- 'libvirt/virt_type': value => $libvirt_virt_type;
- 'libvirt/cpu_mode': value => $libvirt_cpu_mode_real;
- '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 => $libvirt_enabled_perf_events;
- }
-
-
- if $libvirt_cpu_mode_real == 'custom' {
- 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 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;
- }
- }
- }
|