Cleanup listen option from libvirtd service file
This patch ensures that listen option is removed from service file when
libvirt>=5.6 is used, since the option might be left if the deployment
is updated or upgraded from old version.
Related-Bug: #1898553
Related-Bug: #1880619
Change-Id: Ifb0f5e1d7db31885636f689166ff666b049e9414
(cherry picked from commit 2058576291
)
This commit is contained in:
parent
0fb9b479c8
commit
8ab5642322
|
@ -237,53 +237,61 @@ class nova::migration::libvirt(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if versioncmp($libvirt_version, '5.6') >= 0 {
|
if $transport_real == 'tls' or $transport_real == 'tcp' {
|
||||||
# Since libvirt >= 5.6 and libvirtd is managed by systemd,
|
if versioncmp($libvirt_version, '5.6') >= 0 {
|
||||||
# system socket should be activated by systemd, not by --listen option
|
# Since libvirt >= 5.6 and libvirtd is managed by systemd,
|
||||||
$manage_services = pick($::nova::compute::libvirt::manage_libvirt_services, true)
|
# system socket should be activated by systemd, not by --listen option
|
||||||
|
$manage_services = pick($::nova::compute::libvirt::manage_libvirt_services, true)
|
||||||
|
|
||||||
if $manage_services {
|
if $manage_services {
|
||||||
if $transport_real == 'tls' {
|
service { "libvirtd-${transport_real}":
|
||||||
service { 'libvirtd-tls':
|
|
||||||
ensure => 'running',
|
ensure => 'running',
|
||||||
name => 'libvirtd-tls.socket',
|
name => "libvirtd-${transport_real}.socket",
|
||||||
enable => true,
|
enable => true,
|
||||||
require => Anchor['nova::config::end']
|
require => Anchor['nova::config::end']
|
||||||
}
|
}
|
||||||
Service['libvirtd-tls'] -> Service<| title == 'libvirt' |>
|
Service["libvirtd-${transport_real}"] -> Service<| title == 'libvirt' |>
|
||||||
} elsif $transport_real == 'tcp' {
|
|
||||||
service { 'libvirtd-tcp':
|
|
||||||
ensure => 'running',
|
|
||||||
name => 'libvirtd-tcp.socket',
|
|
||||||
enable => true,
|
|
||||||
require => Anchor['nova::config::end']
|
|
||||||
}
|
|
||||||
Service['libvirtd-tcp'] -> Service<| title == 'libvirt' |>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# --listen option should be disabled in newer libvirt
|
||||||
|
$libvirtd_service_listen = false
|
||||||
|
|
||||||
|
} else {
|
||||||
|
# For older libvirt --listen option should be used.
|
||||||
|
$libvirtd_service_listen = true
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
# For older libvirt --listen option should be used.
|
case $::osfamily {
|
||||||
if $transport_real == 'tls' or $transport_real == 'tcp' {
|
'RedHat': {
|
||||||
case $::osfamily {
|
if $libvirtd_service_listen {
|
||||||
'RedHat': {
|
$libvirtd_args = '"--listen"'
|
||||||
file_line { '/etc/sysconfig/libvirtd libvirtd args':
|
} else {
|
||||||
path => '/etc/sysconfig/libvirtd',
|
$libvirtd_args = ''
|
||||||
line => 'LIBVIRTD_ARGS="--listen"',
|
|
||||||
match => '^LIBVIRTD_ARGS=',
|
|
||||||
tag => 'libvirt-file_line',
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
'Debian': {
|
|
||||||
file_line { "/etc/default/${::nova::compute::libvirt::libvirt_service_name} libvirtd opts":
|
file_line { '/etc/sysconfig/libvirtd libvirtd args':
|
||||||
path => "/etc/default/${::nova::compute::libvirt::libvirt_service_name}",
|
path => '/etc/sysconfig/libvirtd',
|
||||||
line => 'libvirtd_opts="-l"',
|
line => "LIBVIRTD_ARGS=${libvirtd_args}",
|
||||||
match => 'libvirtd_opts=',
|
match => '^LIBVIRTD_ARGS=',
|
||||||
tag => 'libvirt-file_line',
|
tag => 'libvirt-file_line',
|
||||||
}
|
|
||||||
}
|
}
|
||||||
default: {
|
}
|
||||||
warning("Unsupported osfamily: ${::osfamily}, make sure you are configuring this yourself")
|
'Debian': {
|
||||||
|
if $libvirtd_service_listen {
|
||||||
|
$libvirtd_opts = '"-l"'
|
||||||
|
} else {
|
||||||
|
$libvirtd_opts = ''
|
||||||
}
|
}
|
||||||
|
|
||||||
|
file_line { "/etc/default/${::nova::compute::libvirt::libvirt_service_name} libvirtd opts":
|
||||||
|
path => "/etc/default/${::nova::compute::libvirt::libvirt_service_name}",
|
||||||
|
line => "libvirtd_opts=${libvirtd_opts}",
|
||||||
|
match => 'libvirtd_opts=',
|
||||||
|
tag => 'libvirt-file_line',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
warning("Unsupported osfamily: ${::osfamily}, make sure you are configuring this yourself")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -263,7 +263,12 @@ describe 'nova::migration::libvirt' do
|
||||||
:libvirt_version => '6.0' }
|
:libvirt_version => '6.0' }
|
||||||
end
|
end
|
||||||
|
|
||||||
it { is_expected.to_not contain_file_line('/etc/default/libvirtd libvirtd opts') }
|
it { is_expected.to contain_file_line('/etc/default/libvirtd libvirtd opts').with(
|
||||||
|
:path => '/etc/default/libvirtd',
|
||||||
|
:line => 'libvirtd_opts=',
|
||||||
|
:match => 'libvirtd_opts=',
|
||||||
|
:tag => 'libvirt-file_line',
|
||||||
|
) }
|
||||||
it { is_expected.to contain_service('libvirtd-tls').with(
|
it { is_expected.to contain_service('libvirtd-tls').with(
|
||||||
:name => 'libvirtd-tls.socket',
|
:name => 'libvirtd-tls.socket',
|
||||||
:ensure => 'running',
|
:ensure => 'running',
|
||||||
|
@ -277,7 +282,12 @@ describe 'nova::migration::libvirt' do
|
||||||
:libvirt_version => '6.0' }
|
:libvirt_version => '6.0' }
|
||||||
end
|
end
|
||||||
|
|
||||||
it { is_expected.to_not contain_file_line('/etc/default/libvirtd libvirtd opts') }
|
it { is_expected.to contain_file_line('/etc/default/libvirtd libvirtd opts').with(
|
||||||
|
:path => '/etc/default/libvirtd',
|
||||||
|
:line => 'libvirtd_opts=',
|
||||||
|
:match => 'libvirtd_opts=',
|
||||||
|
:tag => 'libvirt-file_line',
|
||||||
|
) }
|
||||||
it { is_expected.to contain_service('libvirtd-tcp').with(
|
it { is_expected.to contain_service('libvirtd-tcp').with(
|
||||||
:name => 'libvirtd-tcp.socket',
|
:name => 'libvirtd-tcp.socket',
|
||||||
:ensure => 'running',
|
:ensure => 'running',
|
||||||
|
@ -289,10 +299,10 @@ describe 'nova::migration::libvirt' do
|
||||||
|
|
||||||
shared_examples_for 'nova migration with libvirt in RedHat' do
|
shared_examples_for 'nova migration with libvirt in RedHat' do
|
||||||
context 'with libvirt < 5.6' do
|
context 'with libvirt < 5.6' do
|
||||||
let :params do
|
let :params do
|
||||||
{ :transport => 'tls',
|
{ :transport => 'tls',
|
||||||
:libvirt_version => '4.5' }
|
:libvirt_version => '4.5' }
|
||||||
end
|
end
|
||||||
|
|
||||||
it { is_expected.to contain_file_line('/etc/sysconfig/libvirtd libvirtd args').with(
|
it { is_expected.to contain_file_line('/etc/sysconfig/libvirtd libvirtd args').with(
|
||||||
:path => '/etc/sysconfig/libvirtd',
|
:path => '/etc/sysconfig/libvirtd',
|
||||||
|
@ -312,12 +322,17 @@ describe 'nova::migration::libvirt' do
|
||||||
:libvirt_version => '5.6' }
|
:libvirt_version => '5.6' }
|
||||||
end
|
end
|
||||||
|
|
||||||
it { is_expected.to_not contain_file_line('/etc/sysconfig/libvirtd libvirtd args') }
|
it { is_expected.to contain_file_line('/etc/sysconfig/libvirtd libvirtd args').with(
|
||||||
|
:path => '/etc/sysconfig/libvirtd',
|
||||||
|
:line => 'LIBVIRTD_ARGS=',
|
||||||
|
:match => '^LIBVIRTD_ARGS=',
|
||||||
|
:tag => 'libvirt-file_line',
|
||||||
|
)}
|
||||||
it { is_expected.to contain_service('libvirtd-tls').with(
|
it { is_expected.to contain_service('libvirtd-tls').with(
|
||||||
:name => 'libvirtd-tls.socket',
|
:name => 'libvirtd-tls.socket',
|
||||||
:ensure => 'running',
|
:ensure => 'running',
|
||||||
:enable => true,
|
:enable => true,
|
||||||
)}
|
)}
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with tcp transport' do
|
context 'with tcp transport' do
|
||||||
|
@ -326,12 +341,17 @@ describe 'nova::migration::libvirt' do
|
||||||
:libvirt_version => '5.6' }
|
:libvirt_version => '5.6' }
|
||||||
end
|
end
|
||||||
|
|
||||||
it { is_expected.to_not contain_file_line('/etc/sysconfig/libvirtd libvirtd args') }
|
it { is_expected.to contain_file_line('/etc/sysconfig/libvirtd libvirtd args').with(
|
||||||
|
:path => '/etc/sysconfig/libvirtd',
|
||||||
|
:line => 'LIBVIRTD_ARGS=',
|
||||||
|
:match => '^LIBVIRTD_ARGS=',
|
||||||
|
:tag => 'libvirt-file_line',
|
||||||
|
)}
|
||||||
it { is_expected.to contain_service('libvirtd-tcp').with(
|
it { is_expected.to contain_service('libvirtd-tcp').with(
|
||||||
:name => 'libvirtd-tcp.socket',
|
:name => 'libvirtd-tcp.socket',
|
||||||
:ensure => 'running',
|
:ensure => 'running',
|
||||||
:enable => true,
|
:enable => true,
|
||||||
)}
|
)}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue