migration: split libvirt & nova configs
When running micro-services on compute nodes, nova & libvirt are separated & isolated (ie: containers). nova::migration::libvirt used to configure both nova & libvirt to support migration. This patch makes possible to select what we want (libvirt, nova or both). It will configure all by default for backward compatibility. Depends-On: I33e565638f39ace819645215912303d6e431870c Change-Id: I1a1cb827512b12289558b296a7e64ce2dc71f00a
This commit is contained in:
parent
c32ef24094
commit
a7bdcd95c4
@ -166,8 +166,6 @@ class nova::compute::libvirt (
|
||||
if $vncserver_listen != '0.0.0.0' and $vncserver_listen != '::0' {
|
||||
fail('For migration support to work, you MUST set vncserver_listen to \'0.0.0.0\' or \'::0\'')
|
||||
} else {
|
||||
# TODO(emilien): explode ::nova::migration::libvirt to select what bits we want to configure
|
||||
# and allow micro services between libvirt & nova-compute.
|
||||
include ::nova::migration::libvirt
|
||||
}
|
||||
}
|
||||
|
@ -36,6 +36,14 @@
|
||||
# (optional) Set uuid not equal to output from dmidecode (boolean)
|
||||
# Defaults to false
|
||||
#
|
||||
# [*configure_libvirt*]
|
||||
# (optional) Whether or not configure libvirt bits.
|
||||
# Defaults to true.
|
||||
#
|
||||
# [*configure_nova*]
|
||||
# (optional) Whether or not configure libvirt bits.
|
||||
# Defaults to true.
|
||||
#
|
||||
class nova::migration::libvirt(
|
||||
$use_tls = false,
|
||||
$auth = 'none',
|
||||
@ -43,21 +51,28 @@ class nova::migration::libvirt(
|
||||
$block_migration_flag = undef,
|
||||
$live_migration_tunnelled = $::os_service_default,
|
||||
$override_uuid = false,
|
||||
$configure_libvirt = true,
|
||||
$configure_nova = true,
|
||||
){
|
||||
|
||||
include ::nova::deps
|
||||
|
||||
validate_re($auth, [ '^sasl$', '^none$' ], 'Valid options for auth are none and sasl.')
|
||||
|
||||
if $use_tls {
|
||||
$listen_tls = '1'
|
||||
$listen_tcp = '0'
|
||||
nova_config {
|
||||
'libvirt/live_migration_uri': value => 'qemu+tls://%s/system';
|
||||
}
|
||||
} else {
|
||||
$listen_tls = '0'
|
||||
$listen_tcp = '1'
|
||||
}
|
||||
|
||||
if $configure_nova {
|
||||
if $use_tls {
|
||||
nova_config {
|
||||
'libvirt/live_migration_uri': value => 'qemu+tls://%s/system';
|
||||
}
|
||||
}
|
||||
if $live_migration_flag {
|
||||
nova_config {
|
||||
'libvirt/live_migration_flag': value => $live_migration_flag
|
||||
@ -73,9 +88,9 @@ class nova::migration::libvirt(
|
||||
nova_config {
|
||||
'libvirt/live_migration_tunnelled': value => $live_migration_tunnelled
|
||||
}
|
||||
}
|
||||
|
||||
validate_re($auth, [ '^sasl$', '^none$' ], 'Valid options for auth are none and sasl.')
|
||||
|
||||
if $configure_libvirt {
|
||||
Anchor['nova::config::begin']
|
||||
-> File_line<| tag == 'libvirt-file_line'|>
|
||||
-> Anchor['nova::config::end']
|
||||
@ -195,4 +210,5 @@ class nova::migration::libvirt(
|
||||
warning("Unsupported osfamily: ${::osfamily}, make sure you are configuring this yourself")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -120,6 +120,25 @@ describe 'nova::migration::libvirt' do
|
||||
it { expect { is_expected.to contain_class('nova::compute::libvirt') }.to \
|
||||
raise_error(Puppet::Error, /Valid options for auth are none and sasl./) }
|
||||
end
|
||||
|
||||
context 'when not configuring libvirt' do
|
||||
let :params do
|
||||
{
|
||||
:configure_libvirt => false
|
||||
}
|
||||
end
|
||||
it { is_expected.not_to contain_file_line('/etc/libvirt/libvirtd.conf listen_tls') }
|
||||
end
|
||||
|
||||
context 'when not configuring nova and tls enabled' do
|
||||
let :params do
|
||||
{
|
||||
:configure_nova => false,
|
||||
:use_tls => true,
|
||||
}
|
||||
end
|
||||
it { is_expected.not_to contain_nova_config('libvirt/live_migration_uri').with_value('qemu+tls://%s/system') }
|
||||
end
|
||||
end
|
||||
|
||||
# TODO (degorenko): switch to on_supported_os function when we got Xenial
|
||||
|
Loading…
Reference in New Issue
Block a user