From a6adf208c5c494d4baf81ca5210ece52c9a9e64a Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Thu, 15 Oct 2020 02:07:20 +0900 Subject: [PATCH] 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 451f5203214ede6738cce5f2abeeae93a7f8ae36) (cherry picked from commit 675474d0e55e1c7504ecfdcba65723aea4656142) (cherry picked from commit 736a330cd2084fae4ac3199e5cf6b693f6fedd3a) --- manifests/migration/libvirt.pp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/manifests/migration/libvirt.pp b/manifests/migration/libvirt.pp index aae611002..0b447c817 100644 --- a/manifests/migration/libvirt.pp +++ b/manifests/migration/libvirt.pp @@ -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