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 commit 0e1da12265
)
This commit is contained in:
parent
e6628d679d
commit
6a0a609d57
|
@ -42,12 +42,17 @@
|
|||
# (5 minutes).
|
||||
# Defaults to 300.
|
||||
#
|
||||
# [*manage_service*]
|
||||
# (optional) Whether to start/stop the service
|
||||
# Defaults to false
|
||||
#
|
||||
class nova::compute::libvirt_guests (
|
||||
$enabled = false,
|
||||
$package_ensure = 'present',
|
||||
$shutdown_timeout = '300',
|
||||
$on_boot = 'ignore',
|
||||
$on_shutdown = 'shutdown',
|
||||
$manage_service = false,
|
||||
) {
|
||||
include ::nova::params
|
||||
include ::nova::deps
|
||||
|
@ -56,9 +61,6 @@ class nova::compute::libvirt_guests (
|
|||
-> File_line<| tag == 'libvirt-guests-file_line'|>
|
||||
-> Anchor['nova::config::end']
|
||||
|
||||
File_line<| tag == 'libvirt-guests-file_line' |>
|
||||
~> Service['libvirt-guests']
|
||||
|
||||
case $::osfamily {
|
||||
'RedHat': {
|
||||
file_line { '/etc/sysconfig/libvirt-guests ON_BOOT':
|
||||
|
@ -84,7 +86,7 @@ class nova::compute::libvirt_guests (
|
|||
|
||||
nova::generic_service { 'libvirt-guests':
|
||||
enabled => $enabled,
|
||||
manage_service => $enabled,
|
||||
manage_service => $manage_service,
|
||||
package_name => $::nova::params::libvirt_guests_package_name,
|
||||
service_name => $::nova::params::libvirt_guests_service_name,
|
||||
ensure_package => $package_ensure
|
||||
|
|
|
@ -55,6 +55,16 @@ describe 'nova::compute::libvirt_guests' do
|
|||
)}
|
||||
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
|
||||
|
||||
on_supported_os({
|
||||
|
|
Loading…
Reference in New Issue