Add image preallocation mode option

Image preallocation allows storage to be fully allocated at
instance start. This should significantly improve performance
on writes to new blocks and may even improve I/O performance
to prewritten blocks due to reduced fragmentation.

Change-Id: I1be99c9af8f32b1a7f8408ddeb695fd05a603ace
This commit is contained in:
Michael Polenchuk 2016-12-20 12:37:55 +04:00 committed by Alex Schultz
parent 7b897406aa
commit abe5075878
3 changed files with 24 additions and 9 deletions

View File

@ -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

View File

@ -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.

View File

@ -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('<SERVICE DEFAULT>')}
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')}