Add option to bind libvirtd to a specific IP address
Change-Id: Icd0260cd3a5de130b81a9a7b3fe5b8395594541c
(cherry picked from commit 3b23eff10e
)
This commit is contained in:
parent
70195d886b
commit
5044821594
@ -13,6 +13,10 @@
|
||||
# Valid options are none and sasl.
|
||||
# Defaults to 'none'
|
||||
#
|
||||
# [*listen_address*]
|
||||
# (optional) Bind libvirtd tcp/tls socket to the given address.
|
||||
# Defaults to undef (bind to all addresses)
|
||||
#
|
||||
# [*live_migration_tunnelled*]
|
||||
# (optional) Whether to use tunnelled migration, where migration data is
|
||||
# transported over the libvirtd connection.
|
||||
@ -52,6 +56,7 @@
|
||||
class nova::migration::libvirt(
|
||||
$use_tls = false,
|
||||
$auth = 'none',
|
||||
$listen_address = undef,
|
||||
$live_migration_tunnelled = $::os_service_default,
|
||||
$live_migration_completion_timeout = $::os_service_default,
|
||||
$live_migration_progress_timeout = $::os_service_default,
|
||||
@ -147,6 +152,15 @@ class nova::migration::libvirt(
|
||||
}
|
||||
}
|
||||
|
||||
if $listen_address {
|
||||
file_line { '/etc/libvirt/libvirtd.conf listen_address':
|
||||
path => '/etc/libvirt/libvirtd.conf',
|
||||
line => "listen_addr = \"${listen_address}\"",
|
||||
match => 'listen_addr =',
|
||||
tag => 'libvirt-file_line',
|
||||
}
|
||||
}
|
||||
|
||||
file_line { '/etc/sysconfig/libvirtd libvirtd args':
|
||||
path => '/etc/sysconfig/libvirtd',
|
||||
line => 'LIBVIRTD_ARGS="--listen"',
|
||||
@ -186,6 +200,15 @@ class nova::migration::libvirt(
|
||||
}
|
||||
}
|
||||
|
||||
if $listen_address {
|
||||
file_line { '/etc/libvirt/libvirtd.conf listen_address':
|
||||
path => '/etc/libvirt/libvirtd.conf',
|
||||
line => "listen_addr = \"${listen_address}\"",
|
||||
match => 'listen_addr =',
|
||||
tag => 'libvirt-file_line',
|
||||
}
|
||||
}
|
||||
|
||||
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.
|
||||
|
@ -0,0 +1,4 @@
|
||||
---
|
||||
features:
|
||||
- Add a new parameter, "nova::migration::libvirt::listen_address", to control
|
||||
the address/interface that libvirtd binds to.
|
@ -141,6 +141,15 @@ describe 'nova::migration::libvirt' do
|
||||
end
|
||||
it { is_expected.not_to contain_nova_config('libvirt/live_migration_uri').with_value('qemu+tls://%s/system') }
|
||||
end
|
||||
|
||||
context 'with listen_address set' do
|
||||
let :params do
|
||||
{
|
||||
:listen_address => "127.0.0.1"
|
||||
}
|
||||
end
|
||||
it { is_expected.to contain_file_line('/etc/libvirt/libvirtd.conf listen_address').with(:line => "listen_addr = \"127.0.0.1\"") }
|
||||
end
|
||||
end
|
||||
|
||||
# TODO (degorenko): switch to on_supported_os function when we got Xenial
|
||||
|
Loading…
Reference in New Issue
Block a user