add parameter for libvirt_service_name

Currently the service name is taken from params.
This patch allows to overwrite the parameter.

Change-Id: I673854e81ca3177be9e4b1104fd862590616c163
This commit is contained in:
Benedikt Trefzer 2014-09-29 12:30:34 +02:00
parent 47f50339b2
commit a79e5338df
2 changed files with 21 additions and 2 deletions

View File

@ -61,6 +61,10 @@
# how many seconds it will be removed.
# Defaults to undef
#
# [*libvirt_service_name*]
# (optional) libvirt service name.
# Defaults to $::nova::params::libvirt_service_name
#
class nova::compute::libvirt (
$libvirt_virt_type = 'kvm',
@ -72,6 +76,7 @@ class nova::compute::libvirt (
$remove_unused_kernels = undef,
$remove_unused_resized_minimum_age_seconds = undef,
$remove_unused_original_minimum_age_seconds = undef,
$libvirt_service_name = undef,
# DEPRECATED PARAMETER
$libvirt_type = false
) {
@ -132,10 +137,16 @@ class nova::compute::libvirt (
name => $::nova::params::libvirt_package_name,
}
if $libvirt_service_name {
$libvirt_service_name_real=$libvirt_service_name
} else {
$libvirt_service_name_real=$::nova::params::libvirt_service_name
}
service { 'libvirt' :
ensure => running,
enable => true,
name => $::nova::params::libvirt_service_name,
name => $libvirt_service_name_real,
provider => $::nova::params::special_service_provider,
require => Package['libvirt'],
}

View File

@ -53,7 +53,8 @@ describe 'nova::compute::libvirt' do
:remove_unused_base_images => true,
:remove_unused_kernels => true,
:remove_unused_resized_minimum_age_seconds => 3600,
:remove_unused_original_minimum_age_seconds => 3600
:remove_unused_original_minimum_age_seconds => 3600,
:libvirt_service_name => 'custom_service'
}
end
@ -65,6 +66,13 @@ describe 'nova::compute::libvirt' do
it { should contain_nova_config('DEFAULT/remove_unused_original_minimum_age_seconds').with_value(3600)}
it { should contain_nova_config('libvirt/remove_unused_kernels').with_value(true)}
it { should contain_nova_config('libvirt/remove_unused_resized_minimum_age_seconds').with_value(3600)}
it { should contain_service('libvirt').with(
:name => 'custom_service',
:enable => true,
:ensure => 'running',
:require => 'Package[libvirt]',
:before => 'Service[nova-compute]'
)}
end
describe 'with deprecated params' do