Browse Source

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)
(cherry picked from commit 6a0a609d57)
(cherry picked from commit a555962745)
(cherry picked from commit 9079de85fc)
changes/26/690626/1
Martin Schuppert 4 months ago
parent
commit
9f8fa5147e
2 changed files with 16 additions and 4 deletions
  1. +6
    -4
      manifests/compute/libvirt_guests.pp
  2. +10
    -0
      spec/classes/nova_compute_libvirt_guests_spec.rb

+ 6
- 4
manifests/compute/libvirt_guests.pp View File

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

+ 10
- 0
spec/classes/nova_compute_libvirt_guests_spec.rb View File

@@ -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…
Cancel
Save