qemu: Support a few more migration_* options

This introduces support for a few more migration_* options for QEMU,
which are used to determine the address/network used during migration.

Change-Id: I5cd32eeee428b0bef53a79f5d8bfe9900e64db22
This commit is contained in:
Takashi Kajinami 2024-02-09 17:57:48 +09:00
parent 332fb89413
commit 77913c5073
3 changed files with 31 additions and 0 deletions

View File

@ -8,6 +8,15 @@
# (optional) Whether or not configure qemu bits. # (optional) Whether or not configure qemu bits.
# Defaults to false. # Defaults to false.
# #
# [*migration_address*]
# (optional) Override the listen address for all incoming migrations.
# Defaults to $facts['os_service_default'].
#
# [*migration_host*]
# (optional) The default hostname or IP address which will be used by
# a migration source for transferring migration data to this host.
# Defaults to $facts['os_service_default'].
#
# [*migration_port_min*] # [*migration_port_min*]
# (optional) Lower limit of port range used for migration. # (optional) Lower limit of port range used for migration.
# Defaults to $facts['os_service_default']. # Defaults to $facts['os_service_default'].
@ -18,6 +27,8 @@
# #
class nova::migration::qemu( class nova::migration::qemu(
Boolean $configure_qemu = false, Boolean $configure_qemu = false,
$migration_address = $facts['os_service_default'],
$migration_host = $facts['os_service_default'],
$migration_port_min = $facts['os_service_default'], $migration_port_min = $facts['os_service_default'],
$migration_port_max = $facts['os_service_default'], $migration_port_max = $facts['os_service_default'],
){ ){
@ -28,11 +39,15 @@ class nova::migration::qemu(
if $configure_qemu { if $configure_qemu {
qemu_config { qemu_config {
'migration_address': value => $migration_address;
'migration_host': value => $migration_host;
'migration_port_min': value => $migration_port_min; 'migration_port_min': value => $migration_port_min;
'migration_port_max': value => $migration_port_max; 'migration_port_max': value => $migration_port_max;
} }
} else { } else {
qemu_config { qemu_config {
'migration_address': ensure => absent;
'migration_host': ensure => absent;
'migration_port_min': ensure => absent; 'migration_port_min': ensure => absent;
'migration_port_max': ensure => absent; 'migration_port_max': ensure => absent;
} }

View File

@ -0,0 +1,8 @@
---
features:
- |
The following parameters have been added to the ``nova::migration::qemu``
class.
- ``migration_address``
- ``migration_host``

View File

@ -12,6 +12,8 @@ describe 'nova::migration::qemu' do
context 'when not configuring qemu' do context 'when not configuring qemu' do
it 'should clear all configurations' do it 'should clear all configurations' do
is_expected.to contain_qemu_config('migration_address').with_ensure('absent')
is_expected.to contain_qemu_config('migration_host').with_ensure('absent')
is_expected.to contain_qemu_config('migration_port_min').with_ensure('absent') is_expected.to contain_qemu_config('migration_port_min').with_ensure('absent')
is_expected.to contain_qemu_config('migration_port_max').with_ensure('absent') is_expected.to contain_qemu_config('migration_port_max').with_ensure('absent')
end end
@ -24,6 +26,8 @@ describe 'nova::migration::qemu' do
} }
end end
it 'should configure the default values' do it 'should configure the default values' do
is_expected.to contain_qemu_config('migration_address').with_value('<SERVICE DEFAULT>')
is_expected.to contain_qemu_config('migration_host').with_value('<SERVICE DEFAULT>')
is_expected.to contain_qemu_config('migration_port_min').with_value('<SERVICE DEFAULT>') is_expected.to contain_qemu_config('migration_port_min').with_value('<SERVICE DEFAULT>')
is_expected.to contain_qemu_config('migration_port_max').with_value('<SERVICE DEFAULT>') is_expected.to contain_qemu_config('migration_port_max').with_value('<SERVICE DEFAULT>')
end end
@ -33,11 +37,15 @@ describe 'nova::migration::qemu' do
let :params do let :params do
{ {
:configure_qemu => true, :configure_qemu => true,
:migration_address => '0.0.0.0',
:migration_host => 'host.example.com',
:migration_port_min => 61138, :migration_port_min => 61138,
:migration_port_max => 61200, :migration_port_max => 61200,
} }
end end
it 'should configure the given values' do it 'should configure the given values' do
is_expected.to contain_qemu_config('migration_address').with_value('0.0.0.0')
is_expected.to contain_qemu_config('migration_host').with_value('host.example.com')
is_expected.to contain_qemu_config('migration_port_min').with_value(61138) is_expected.to contain_qemu_config('migration_port_min').with_value(61138)
is_expected.to contain_qemu_config('migration_port_max').with_value(61200) is_expected.to contain_qemu_config('migration_port_max').with_value(61200)
end end