diff --git a/manifests/compute/libvirt.pp b/manifests/compute/libvirt.pp index 1eda96664..caf8353fc 100644 --- a/manifests/compute/libvirt.pp +++ b/manifests/compute/libvirt.pp @@ -101,6 +101,11 @@ # (optional) Compute driver. # Defaults to 'libvirt.LibvirtDriver' # +# [*preallocate_images*] +# (optional) The image preallocation mode to use. +# Valid values are 'none' or 'space'. +# Defaults to $::os_service_default +# # [*manage_libvirt_services*] # (optional) Whether or not deploy Libvirt services. # In the case of micro-services, set it to False and use @@ -128,6 +133,7 @@ class nova::compute::libvirt ( $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 { @@ -186,15 +192,16 @@ class nova::compute::libvirt ( } nova_config { - 'DEFAULT/compute_driver': value => $compute_driver; - '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; + '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; } # cpu_model param is only valid if cpu_mode=custom diff --git a/releasenotes/notes/add_preallocate_images_option-24711e88218b09ca.yaml b/releasenotes/notes/add_preallocate_images_option-24711e88218b09ca.yaml new file mode 100644 index 000000000..13a23edc6 --- /dev/null +++ b/releasenotes/notes/add_preallocate_images_option-24711e88218b09ca.yaml @@ -0,0 +1,5 @@ +--- +features: + - Added preallocate_images option which allows storage for instance images + to be allocated up front when the instance is initially provisioned. + This should significantly improve performance on writes to new blocks. diff --git a/spec/classes/nova_compute_libvirt_spec.rb b/spec/classes/nova_compute_libvirt_spec.rb index 098bc0457..3b18bd780 100644 --- a/spec/classes/nova_compute_libvirt_spec.rb +++ b/spec/classes/nova_compute_libvirt_spec.rb @@ -46,6 +46,7 @@ describe 'nova::compute::libvirt' do } it { is_expected.to contain_nova_config('DEFAULT/compute_driver').with_value('libvirt.LibvirtDriver')} + it { is_expected.to contain_nova_config('DEFAULT/preallocate_images').with_value('')} it { is_expected.to contain_nova_config('libvirt/virt_type').with_value('kvm')} it { is_expected.to contain_nova_config('libvirt/cpu_mode').with_value('host-model')} it { is_expected.to contain_nova_config('libvirt/cpu_model').with_ensure('absent')} @@ -76,6 +77,7 @@ describe 'nova::compute::libvirt' do :virtlock_service_name => 'virtlock', :virtlog_service_name => 'virtlog', :compute_driver => 'libvirt.FoobarDriver', + :preallocate_images => 'space', } end @@ -84,6 +86,7 @@ describe 'nova::compute::libvirt' do :ensure => 'latest' ) } it { is_expected.to contain_nova_config('DEFAULT/compute_driver').with_value('libvirt.FoobarDriver')} + it { is_expected.to contain_nova_config('DEFAULT/preallocate_images').with_value('space')} it { is_expected.to contain_nova_config('libvirt/virt_type').with_value('qemu')} it { is_expected.to contain_nova_config('libvirt/cpu_mode').with_value('host-passthrough')} it { is_expected.to contain_nova_config('libvirt/cpu_model').with_ensure('absent')}