compute: manage force_raw_images parameter

In Nova, force_raw_images allows to force backing images to raw
format.
Some use-cases require to disable this feature.

Let's use nova::compute class to manage this option, and let at True
by default as this the case in Nova (Juno release).

Change-Id: I4d700204bfd1d297667303b11e572f24dc9af2fc
Signed-off-by: Emilien Macchi <emilien.macchi@enovance.com>
This commit is contained in:
Emilien Macchi
2014-09-17 19:54:56 -04:00
parent 0c402aeed6
commit 5db5c7652e
2 changed files with 16 additions and 2 deletions

View File

@@ -69,6 +69,10 @@
# Time period must be hour, day, month or year # Time period must be hour, day, month or year
# Defaults to 'month' # Defaults to 'month'
# #
# [*force_raw_images*]
# (optional) Force backing images to raw format.
# Defaults to true
#
class nova::compute ( class nova::compute (
$enabled = false, $enabled = false,
$manage_service = true, $manage_service = true,
@@ -85,7 +89,8 @@ class nova::compute (
$neutron_enabled = true, $neutron_enabled = true,
$network_device_mtu = undef, $network_device_mtu = undef,
$instance_usage_audit = false, $instance_usage_audit = false,
$instance_usage_audit_period = 'month' $instance_usage_audit_period = 'month',
$force_raw_images = true,
) { ) {
include nova::params include nova::params
@@ -159,4 +164,8 @@ class nova::compute (
package { 'pm-utils': package { 'pm-utils':
ensure => present, ensure => present,
} }
nova_config {
'DEFAULT/force_raw_images': value => $force_raw_images;
}
} }

View File

@@ -33,6 +33,8 @@ describe 'nova::compute' do
it { should contain_package('pm-utils').with( it { should contain_package('pm-utils').with(
:ensure => 'present' :ensure => 'present'
) } ) }
it { should contain_nova_config('DEFAULT/force_raw_images').with(:value => true) }
end end
context 'with overridden parameters' do context 'with overridden parameters' do
@@ -40,7 +42,8 @@ describe 'nova::compute' do
{ :enabled => true, { :enabled => true,
:ensure_package => '2012.1-2', :ensure_package => '2012.1-2',
:vncproxy_host => '127.0.0.1', :vncproxy_host => '127.0.0.1',
:network_device_mtu => 9999 } :network_device_mtu => 9999,
:force_raw_images => false }
end end
it 'installs nova-compute package and service' do it 'installs nova-compute package and service' do
@@ -67,6 +70,8 @@ describe 'nova::compute' do
'http://127.0.0.1:6080/vnc_auto.html' 'http://127.0.0.1:6080/vnc_auto.html'
) )
end end
it { should contain_nova_config('DEFAULT/force_raw_images').with(:value => false) }
end end
context 'with neutron_enabled set to false' do context 'with neutron_enabled set to false' do