Disable libvirtd.service before starting sockets

This change makes sure that libvirtd.service is stopped when starting
libvirtd-tcp/tls.socket, because these socket fails to start if
libvirtd.service is already running.

Depends-on: https://review.opendev.org/#/c/759595/
Change-Id: I4a670aa77f0f0406a96db07877354b5067ddf1da
(cherry picked from commit 451f520321)
(cherry picked from commit 675474d0e5)
(cherry picked from commit 736a330cd2)
This commit is contained in:
Takashi Kajinami 2020-10-15 02:07:20 +09:00 committed by Tobias Urdin
parent 0376c212ee
commit a6adf208c5
1 changed files with 11 additions and 1 deletions

View File

@ -274,13 +274,23 @@ class nova::migration::libvirt(
$manage_services = pick($::nova::compute::libvirt::manage_libvirt_services, true)
if $manage_services {
# libvirtd.service should be stopped before socket service is started.
# Otherwise, socket service fails to start.
exec { 'stop libvirtd.service':
path => ['/sbin', '/usr/sbin', '/bin', '/usr/bin'],
command => 'systemctl -q stop libvirtd.service',
unless => "systemctl -q is-active libvirtd-${transport_real}.socket",
require => Anchor['nova::install::end']
}
service { "libvirtd-${transport_real}":
ensure => 'running',
name => "libvirtd-${transport_real}.socket",
enable => true,
require => Anchor['nova::config::end']
}
Service["libvirtd-${transport_real}"] -> Service<| title == 'libvirt' |>
Exec['stop libvirtd.service'] -> Service["libvirtd-${transport_real}"] -> Service<| title == 'libvirt' |>
}
# --listen option should be disabled in newer libvirt