Don't restart libvirt-guests on config change
When there is a config change the service gets notfied to be restarted, which is not required as /usr/libexec/libvirt-guests.sh sources /etc/sysconfig/libvirt-guests on each run. As a side effect of the service restart, instances get stopped which is bad. In addition manage_service was bound to the enabled parameter. This introduces manage_service to be able to manage start/stop independent from enabled parameter. Change-Id: Icf52a2272601401c423ae07f7b10474bdc190574 Closes-Bug: #1849264 (cherry picked from commit0e1da12265
) (cherry picked from commit6a0a609d57
) (cherry picked from commita555962745
) (cherry picked from commit9079de85fc
)
This commit is contained in:
parent
b876ace5fa
commit
9f8fa5147e
|
@ -42,12 +42,17 @@
|
||||||
# (5 minutes).
|
# (5 minutes).
|
||||||
# Defaults to 300.
|
# Defaults to 300.
|
||||||
#
|
#
|
||||||
|
# [*manage_service*]
|
||||||
|
# (optional) Whether to start/stop the service
|
||||||
|
# Defaults to false
|
||||||
|
#
|
||||||
class nova::compute::libvirt_guests (
|
class nova::compute::libvirt_guests (
|
||||||
$enabled = false,
|
$enabled = false,
|
||||||
$package_ensure = 'present',
|
$package_ensure = 'present',
|
||||||
$shutdown_timeout = '300',
|
$shutdown_timeout = '300',
|
||||||
$on_boot = 'ignore',
|
$on_boot = 'ignore',
|
||||||
$on_shutdown = 'shutdown',
|
$on_shutdown = 'shutdown',
|
||||||
|
$manage_service = false,
|
||||||
) {
|
) {
|
||||||
include ::nova::params
|
include ::nova::params
|
||||||
include ::nova::deps
|
include ::nova::deps
|
||||||
|
@ -56,9 +61,6 @@ class nova::compute::libvirt_guests (
|
||||||
-> File_line<| tag == 'libvirt-guests-file_line'|>
|
-> File_line<| tag == 'libvirt-guests-file_line'|>
|
||||||
-> Anchor['nova::config::end']
|
-> Anchor['nova::config::end']
|
||||||
|
|
||||||
File_line<| tag == 'libvirt-guests-file_line' |>
|
|
||||||
~> Service['libvirt-guests']
|
|
||||||
|
|
||||||
case $::osfamily {
|
case $::osfamily {
|
||||||
'RedHat': {
|
'RedHat': {
|
||||||
file_line { '/etc/sysconfig/libvirt-guests ON_BOOT':
|
file_line { '/etc/sysconfig/libvirt-guests ON_BOOT':
|
||||||
|
@ -84,7 +86,7 @@ class nova::compute::libvirt_guests (
|
||||||
|
|
||||||
nova::generic_service { 'libvirt-guests':
|
nova::generic_service { 'libvirt-guests':
|
||||||
enabled => $enabled,
|
enabled => $enabled,
|
||||||
manage_service => $enabled,
|
manage_service => $manage_service,
|
||||||
package_name => $::nova::params::libvirt_guests_package_name,
|
package_name => $::nova::params::libvirt_guests_package_name,
|
||||||
service_name => $::nova::params::libvirt_guests_service_name,
|
service_name => $::nova::params::libvirt_guests_service_name,
|
||||||
ensure_package => $package_ensure
|
ensure_package => $package_ensure
|
||||||
|
|
|
@ -55,6 +55,16 @@ describe 'nova::compute::libvirt_guests' do
|
||||||
)}
|
)}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'while not managing service state' do
|
||||||
|
let :params do
|
||||||
|
{ :enabled => false,
|
||||||
|
:manage_service => false,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
it { is_expected.to contain_service('libvirt-guests').without_ensure }
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
on_supported_os({
|
on_supported_os({
|
||||||
|
|
Loading…
Reference in New Issue