online_data_migrations: allow passing command line params to migrations
The existing extra_params only works for generic ironic-dbsync arguments (like --config-file), but not for arguments specific to migrations (like --max-count). Change-Id: I693738c8b4f7b99082fca56137af6cbe24c06213 Related-Bug: #1690185
This commit is contained in:
parent
f72793c5ad
commit
dd2b63c6f6
|
@ -8,15 +8,22 @@
|
||||||
# to the ironic-dbsync command.
|
# to the ironic-dbsync command.
|
||||||
# Defaults to undef
|
# Defaults to undef
|
||||||
#
|
#
|
||||||
|
# [*migration_params*]
|
||||||
|
# (optional) String of extra command line parameters to pass to migrations.
|
||||||
|
# Unlike extra_params, these apply to migrations themselves, not to the
|
||||||
|
# ironic-dbsync command.
|
||||||
|
# Defaults to undef
|
||||||
|
#
|
||||||
class ironic::db::online_data_migrations(
|
class ironic::db::online_data_migrations(
|
||||||
$extra_params = undef,
|
$extra_params = undef,
|
||||||
|
$migration_params = undef,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
include ::ironic::deps
|
include ::ironic::deps
|
||||||
include ::ironic::params
|
include ::ironic::params
|
||||||
|
|
||||||
exec { 'ironic-db-online-data-migrations':
|
exec { 'ironic-db-online-data-migrations':
|
||||||
command => "${::ironic::params::dbsync_command} ${extra_params} online_data_migrations",
|
command => "${::ironic::params::dbsync_command} ${extra_params} online_data_migrations ${migration_params}",
|
||||||
path => '/usr/bin',
|
path => '/usr/bin',
|
||||||
user => 'ironic',
|
user => 'ironic',
|
||||||
refreshonly => true,
|
refreshonly => true,
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
Add new parameter ``ironic::db::online_data_migrations::migration_params``
|
||||||
|
to allow passing arguments to migration themselves (``extra_params`` passes
|
||||||
|
arguments to the ``ironic-dbsync`` command itself and cannot be used to
|
||||||
|
tune migrations).
|
|
@ -6,7 +6,7 @@ describe 'ironic::db::online_data_migrations' do
|
||||||
|
|
||||||
it 'runs ironic-db-sync' do
|
it 'runs ironic-db-sync' do
|
||||||
is_expected.to contain_exec('ironic-db-online-data-migrations').with(
|
is_expected.to contain_exec('ironic-db-online-data-migrations').with(
|
||||||
:command => 'ironic-dbsync --config-file /etc/ironic/ironic.conf online_data_migrations',
|
:command => 'ironic-dbsync --config-file /etc/ironic/ironic.conf online_data_migrations ',
|
||||||
:path => '/usr/bin',
|
:path => '/usr/bin',
|
||||||
:user => 'ironic',
|
:user => 'ironic',
|
||||||
:refreshonly => 'true',
|
:refreshonly => 'true',
|
||||||
|
@ -24,13 +24,14 @@ describe 'ironic::db::online_data_migrations' do
|
||||||
describe "overriding extra_params" do
|
describe "overriding extra_params" do
|
||||||
let :params do
|
let :params do
|
||||||
{
|
{
|
||||||
:extra_params => '--config-file /etc/ironic/ironic_01.conf',
|
:extra_params => '--config-file /etc/ironic/ironic_01.conf',
|
||||||
|
:migration_params => '--max-count 100',
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
it {
|
it {
|
||||||
is_expected.to contain_exec('ironic-db-online-data-migrations').with(
|
is_expected.to contain_exec('ironic-db-online-data-migrations').with(
|
||||||
:command => 'ironic-dbsync --config-file /etc/ironic/ironic.conf --config-file /etc/ironic/ironic_01.conf online_data_migrations',
|
:command => 'ironic-dbsync --config-file /etc/ironic/ironic.conf --config-file /etc/ironic/ironic_01.conf online_data_migrations --max-count 100',
|
||||||
:path => '/usr/bin',
|
:path => '/usr/bin',
|
||||||
:user => 'ironic',
|
:user => 'ironic',
|
||||||
:refreshonly => 'true',
|
:refreshonly => 'true',
|
||||||
|
|
Loading…
Reference in New Issue