Ubuntu has libvirt 6.0

The UCA repo has libvirt 6.0 from Ussuri
on Bionic and later.

Closes-Bug: #1898553
Change-Id: I8146f5b073e812f3cac472fc5e27976f17d248b4
This commit is contained in:
Tobias Urdin 2020-09-03 01:19:05 +02:00 committed by Takashi Kajinami
parent 079ab8d663
commit a44641df76
3 changed files with 84 additions and 47 deletions

View File

@ -32,8 +32,8 @@ class nova::compute::libvirt::version {
} }
} }
'Debian': { 'Debian': {
if versioncmp($facts['os']['release']['full'], '18.10') >= 0 { if versioncmp($facts['os']['release']['full'], '18.04') >= 0 {
$default = '4.6' $default = '6.0'
} else { } else {
$default = '4.0' $default = '4.0'
} }

View File

@ -237,33 +237,35 @@ class nova::migration::libvirt(
} }
} }
case $::osfamily { if versioncmp($libvirt_version, '5.6') >= 0 {
'RedHat': { # 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
$manage_services = pick($::nova::compute::libvirt::manage_libvirt_services, true) $manage_services = pick($::nova::compute::libvirt::manage_libvirt_services, true)
if $manage_services { if $manage_services {
if $transport_real == 'tls' { if $transport_real == 'tls' {
service { 'libvirtd-tls': service { 'libvirtd-tls':
ensure => 'running', ensure => 'running',
name => 'libvirtd-tls.socket', name => 'libvirtd-tls.socket',
enable => true, enable => true,
require => Anchor['nova::config::end'] require => Anchor['nova::config::end']
}
Service['libvirtd-tls'] -> 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' |>
}
} }
Service['libvirtd-tls'] -> Service<| title == 'libvirt' |>
} else { } elsif $transport_real == 'tcp' {
if $transport_real != 'ssh' { service { 'libvirtd-tcp':
ensure => 'running',
name => 'libvirtd-tcp.socket',
enable => true,
require => Anchor['nova::config::end']
}
Service['libvirtd-tcp'] -> Service<| title == 'libvirt' |>
}
}
} else {
# For older libvirt --listen option should be used.
if $transport_real == 'tls' or $transport_real == 'tcp' {
case $::osfamily {
'RedHat': {
file_line { '/etc/sysconfig/libvirtd libvirtd args': file_line { '/etc/sysconfig/libvirtd libvirtd args':
path => '/etc/sysconfig/libvirtd', path => '/etc/sysconfig/libvirtd',
line => 'LIBVIRTD_ARGS="--listen"', line => 'LIBVIRTD_ARGS="--listen"',
@ -271,23 +273,19 @@ class nova::migration::libvirt(
tag => 'libvirt-file_line', tag => 'libvirt-file_line',
} }
} }
} 'Debian': {
} file_line { "/etc/default/${::nova::compute::libvirt::libvirt_service_name} libvirtd opts":
path => "/etc/default/${::nova::compute::libvirt::libvirt_service_name}",
'Debian': { line => 'libvirtd_opts="-l"',
if $transport_real != 'ssh' { match => 'libvirtd_opts=',
file_line { "/etc/default/${::nova::compute::libvirt::libvirt_service_name} libvirtd opts": tag => 'libvirt-file_line',
path => "/etc/default/${::nova::compute::libvirt::libvirt_service_name}", }
line => 'libvirtd_opts="-l"', }
match => 'libvirtd_opts=', default: {
tag => 'libvirt-file_line', warning("Unsupported osfamily: ${::osfamily}, make sure you are configuring this yourself")
} }
} }
} }
default: {
warning("Unsupported osfamily: ${::osfamily}, make sure you are configuring this yourself")
}
} }
} }
} }

View File

@ -240,12 +240,51 @@ describe 'nova::migration::libvirt' do
end end
shared_examples_for 'nova migration with libvirt in Debian' do shared_examples_for 'nova migration with libvirt in Debian' do
it { is_expected.to contain_file_line('/etc/default/libvirtd libvirtd opts').with( context 'with libvirt < 5.6' do
:path => '/etc/default/libvirtd', let :params do
:line => 'libvirtd_opts="-l"', { :transport => 'tls',
:match => 'libvirtd_opts=', :libvirt_version => '4.0' }
:tag => 'libvirt-file_line', end
) }
it { is_expected.to contain_file_line('/etc/default/libvirtd libvirtd opts').with(
:path => '/etc/default/libvirtd',
:line => 'libvirtd_opts="-l"',
:match => 'libvirtd_opts=',
:tag => 'libvirt-file_line',
) }
it { is_expected.to_not contain_service('libvirtd-tls') }
it { is_expected.to_not contain_service('libvirtd-tcp') }
end
context 'with libvirt >= 5.6' do
context 'with tls transport' do
let :params do
{ :transport => 'tls',
:libvirt_version => '6.0' }
end
it { is_expected.to_not contain_file_line('/etc/default/libvirtd libvirtd opts') }
it { is_expected.to contain_service('libvirtd-tls').with(
:name => 'libvirtd-tls.socket',
:ensure => 'running',
:enable => true,
)}
end
context 'with tcp transport' do
let :params do
{ :transport => 'tcp',
:libvirt_version => '6.0' }
end
it { is_expected.to_not contain_file_line('/etc/default/libvirtd libvirtd opts') }
it { is_expected.to contain_service('libvirtd-tcp').with(
:name => 'libvirtd-tcp.socket',
:ensure => 'running',
:enable => true,
)}
end
end
end end
shared_examples_for 'nova migration with libvirt in RedHat' do shared_examples_for 'nova migration with libvirt in RedHat' do