Merge "Fix libvirtd_opts when using systemd"
This commit is contained in:
commit
2b5cf16ec2
|
@ -159,9 +159,17 @@ class nova::migration::libvirt(
|
|||
}
|
||||
}
|
||||
|
||||
if $::operatingsystem == 'Ubuntu' and versioncmp($::operatingsystemmajrelease, '16') >= 0 {
|
||||
# If systemd is being used then libvirtd is already being launched correctly and
|
||||
# adding -d causes a second consecutive start to fail which causes puppet to fail.
|
||||
$libvirtd_opts = 'libvirtd_opts="-l"'
|
||||
} else {
|
||||
$libvirtd_opts = 'libvirtd_opts="-d -l"'
|
||||
}
|
||||
|
||||
file_line { "/etc/default/${::nova::compute::libvirt::libvirt_service_name} libvirtd opts":
|
||||
path => "/etc/default/${::nova::compute::libvirt::libvirt_service_name}",
|
||||
line => 'libvirtd_opts="-d -l"',
|
||||
line => $libvirtd_opts,
|
||||
match => 'libvirtd_opts=',
|
||||
tag => 'libvirt-file_line',
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
require 'spec_helper'
|
||||
require 'puppet/util/package'
|
||||
describe 'nova::compute::libvirt' do
|
||||
|
||||
let :pre_condition do
|
||||
|
@ -6,6 +7,14 @@ describe 'nova::compute::libvirt' do
|
|||
end
|
||||
|
||||
shared_examples 'debian-nova-compute-libvirt' do
|
||||
let(:libvirt_options) do
|
||||
if facts[:operatingsystem] == 'Ubuntu' and Puppet::Util::Package.versioncmp(facts[:operatingsystemmajrelease], '16') >= 0
|
||||
'libvirtd_opts="-l"'
|
||||
else
|
||||
'libvirtd_opts="-d -l"'
|
||||
end
|
||||
end
|
||||
|
||||
describe 'with default parameters' do
|
||||
|
||||
it { is_expected.to contain_class('nova::params')}
|
||||
|
@ -127,7 +136,7 @@ describe 'nova::compute::libvirt' do
|
|||
|
||||
it { is_expected.to contain_class('nova::migration::libvirt')}
|
||||
it { is_expected.to contain_nova_config('vnc/vncserver_listen').with_value('0.0.0.0')}
|
||||
it { is_expected.to contain_file_line('/etc/default/libvirt-bin libvirtd opts').with(:line => 'libvirtd_opts="-d -l"') }
|
||||
it { is_expected.to contain_file_line('/etc/default/libvirt-bin libvirtd opts').with(:line => libvirt_options) }
|
||||
it { is_expected.to contain_file_line('/etc/libvirt/libvirtd.conf listen_tls').with(:line => "listen_tls = 0") }
|
||||
it { is_expected.to contain_file_line('/etc/libvirt/libvirtd.conf listen_tcp').with(:line => "listen_tcp = 1") }
|
||||
it { is_expected.not_to contain_file_line('/etc/libvirt/libvirtd.conf auth_tls')}
|
||||
|
@ -142,7 +151,7 @@ describe 'nova::compute::libvirt' do
|
|||
|
||||
it { is_expected.to contain_class('nova::migration::libvirt')}
|
||||
it { is_expected.to contain_nova_config('vnc/vncserver_listen').with_value('::0')}
|
||||
it { is_expected.to contain_file_line('/etc/default/libvirt-bin libvirtd opts').with(:line => 'libvirtd_opts="-d -l"') }
|
||||
it { is_expected.to contain_file_line('/etc/default/libvirt-bin libvirtd opts').with(:line => libvirt_options) }
|
||||
it { is_expected.to contain_file_line('/etc/libvirt/libvirtd.conf listen_tls').with(:line => "listen_tls = 0") }
|
||||
it { is_expected.to contain_file_line('/etc/libvirt/libvirtd.conf listen_tcp').with(:line => "listen_tcp = 1") }
|
||||
it { is_expected.not_to contain_file_line('/etc/libvirt/libvirtd.conf auth_tls')}
|
||||
|
@ -165,7 +174,7 @@ describe 'nova::compute::libvirt' do
|
|||
:vncserver_listen => '0.0.0.0',
|
||||
:migration_support => true }
|
||||
end
|
||||
it { is_expected.to contain_file_line('/etc/default/libvirtd libvirtd opts').with(:line => 'libvirtd_opts="-d -l"') }
|
||||
it { is_expected.to contain_file_line('/etc/default/libvirtd libvirtd opts').with(:line => libvirt_options) }
|
||||
|
||||
end
|
||||
end
|
||||
|
@ -337,19 +346,21 @@ describe 'nova::compute::libvirt' do
|
|||
@default_facts.merge({
|
||||
:osfamily => 'Debian',
|
||||
:operatingsystem => 'Debian',
|
||||
:os_package_family => 'debian'
|
||||
:os_package_family => 'debian',
|
||||
:operatingsystemmajrelease => '8'
|
||||
})
|
||||
end
|
||||
|
||||
it_behaves_like 'debian-nova-compute-libvirt'
|
||||
end
|
||||
|
||||
context 'on Debian platforms' do
|
||||
context 'on Ubuntu platforms' do
|
||||
let (:facts) do
|
||||
@default_facts.merge({
|
||||
:osfamily => 'Debian',
|
||||
:operatingsystem => 'Ubuntu',
|
||||
:os_package_family => 'ubuntu'
|
||||
:os_package_family => 'ubuntu',
|
||||
:operatingsystemmajrelease => '16.04'
|
||||
})
|
||||
end
|
||||
|
||||
|
@ -360,7 +371,7 @@ describe 'nova::compute::libvirt' do
|
|||
let (:facts) do
|
||||
@default_facts.merge({
|
||||
:osfamily => 'RedHat',
|
||||
:os_package_type => 'rpm'
|
||||
:os_package_type => 'rpm',
|
||||
})
|
||||
end
|
||||
|
||||
|
|
|
@ -119,9 +119,27 @@ describe 'nova::migration::libvirt' do
|
|||
end
|
||||
end
|
||||
|
||||
context 'on Debian platforms' do
|
||||
# TODO (degorenko): switch to on_supported_os function when we got Xenial
|
||||
context 'on Debian platforms with Ubuntu release 16' do
|
||||
let :facts do
|
||||
@default_facts.merge({ :osfamily => 'Debian' })
|
||||
@default_facts.merge({
|
||||
:osfamily => 'Debian',
|
||||
:operatingsystem => 'Ubuntu',
|
||||
:operatingsystemmajrelease => '16'
|
||||
})
|
||||
end
|
||||
|
||||
it_configures 'nova migration with libvirt'
|
||||
it { is_expected.to contain_file_line('/etc/default/libvirt-bin libvirtd opts').with(:line => 'libvirtd_opts="-l"') }
|
||||
end
|
||||
|
||||
context 'on Debian platforms release' do
|
||||
let :facts do
|
||||
@default_facts.merge({
|
||||
:osfamily => 'Debian',
|
||||
:operatingsystem => 'Debian',
|
||||
:operatingsystemmajrelease => '8'
|
||||
})
|
||||
end
|
||||
|
||||
it_configures 'nova migration with libvirt'
|
||||
|
@ -130,7 +148,11 @@ describe 'nova::migration::libvirt' do
|
|||
|
||||
context 'on RedHat platforms' do
|
||||
let :facts do
|
||||
@default_facts.merge({ :osfamily => 'RedHat' })
|
||||
@default_facts.merge({
|
||||
:osfamily => 'RedHat',
|
||||
:operatingsystem => 'CentOS',
|
||||
:operatingsystemmajrelease => '7.0'
|
||||
})
|
||||
end
|
||||
|
||||
it_configures 'nova migration with libvirt'
|
||||
|
|
Loading…
Reference in New Issue