Add a class to run the db online_data_migrations
This adds support for running the online_data_migrations which needs to happen after a dbsync when you upgrade to Pike. If it's not run, upgrade from Pike to Queens won't work in the future. Change-Id: I548c80cf138b661ba3a5e45a6dfe8711f3322ed0 Closes-Bug: #1708149
This commit is contained in:

committed by
Alex Schultz

parent
68b9e72864
commit
bf5a8ee3fc
34
manifests/db/online_data_migrations.pp
Normal file
34
manifests/db/online_data_migrations.pp
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
#
|
||||||
|
# Class to execute ironic online_data_migrations
|
||||||
|
#
|
||||||
|
# ==Parameters
|
||||||
|
#
|
||||||
|
# [*extra_params*]
|
||||||
|
# (optional) String of extra command line parameters to append
|
||||||
|
# to the ironic-dbsync command.
|
||||||
|
# Defaults to undef
|
||||||
|
#
|
||||||
|
class ironic::db::online_data_migrations(
|
||||||
|
$extra_params = undef,
|
||||||
|
) {
|
||||||
|
|
||||||
|
include ::ironic::deps
|
||||||
|
include ::ironic::params
|
||||||
|
|
||||||
|
exec { 'ironic-db-online-data-migrations':
|
||||||
|
command => "${::ironic::params::dbsync_command} ${extra_params} online_data_migrations",
|
||||||
|
path => '/usr/bin',
|
||||||
|
user => 'ironic',
|
||||||
|
refreshonly => true,
|
||||||
|
try_sleep => 5,
|
||||||
|
tries => 10,
|
||||||
|
logoutput => on_failure,
|
||||||
|
subscribe => [
|
||||||
|
Anchor['ironic::install::end'],
|
||||||
|
Anchor['ironic::config::end'],
|
||||||
|
Anchor['ironic::dbsync::end'],
|
||||||
|
Anchor['ironic::db_online_data_migrations::begin']
|
||||||
|
],
|
||||||
|
notify => Anchor['ironic::db_online_data_migrations::end'],
|
||||||
|
}
|
||||||
|
}
|
@@ -20,6 +20,8 @@ class ironic::deps {
|
|||||||
-> anchor { 'ironic::db::end': }
|
-> anchor { 'ironic::db::end': }
|
||||||
~> anchor { 'ironic::dbsync::begin': }
|
~> anchor { 'ironic::dbsync::begin': }
|
||||||
-> anchor { 'ironic::dbsync::end': }
|
-> anchor { 'ironic::dbsync::end': }
|
||||||
|
~> anchor { 'ironic::db_online_data_migrations::begin': }
|
||||||
|
-> anchor { 'ironic::db_online_data_migrations::end': }
|
||||||
~> anchor { 'ironic::service::begin': }
|
~> anchor { 'ironic::service::begin': }
|
||||||
~> Service<| tag == 'ironic-service' |>
|
~> Service<| tag == 'ironic-service' |>
|
||||||
~> anchor { 'ironic::service::end': }
|
~> anchor { 'ironic::service::end': }
|
||||||
|
@@ -231,6 +231,10 @@
|
|||||||
# Enable dbsync
|
# Enable dbsync
|
||||||
# Defaults to true
|
# Defaults to true
|
||||||
#
|
#
|
||||||
|
# [*db_online_data_migrations*]
|
||||||
|
# (optional) Run online_data_migrations - required on upgrade.
|
||||||
|
# Defaults to false.
|
||||||
|
#
|
||||||
# [*purge_config*]
|
# [*purge_config*]
|
||||||
# (optional) Whether to set only the specified config options
|
# (optional) Whether to set only the specified config options
|
||||||
# in the ironic config.
|
# in the ironic config.
|
||||||
@@ -328,6 +332,7 @@ class ironic (
|
|||||||
$database_max_pool_size = undef,
|
$database_max_pool_size = undef,
|
||||||
$database_max_overflow = undef,
|
$database_max_overflow = undef,
|
||||||
$sync_db = true,
|
$sync_db = true,
|
||||||
|
$db_online_data_migrations = false,
|
||||||
$purge_config = false,
|
$purge_config = false,
|
||||||
# DEPRECATED PARAMETERS
|
# DEPRECATED PARAMETERS
|
||||||
$rabbit_host = $::os_service_default,
|
$rabbit_host = $::os_service_default,
|
||||||
@@ -393,6 +398,10 @@ ironic::glance::api_insecure and ironic::glance::num_retries accordingly")
|
|||||||
include ::ironic::db::sync
|
include ::ironic::db::sync
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if $db_online_data_migrations {
|
||||||
|
include ::ironic::db::online_data_migrations
|
||||||
|
}
|
||||||
|
|
||||||
oslo::messaging::default {'ironic_config':
|
oslo::messaging::default {'ironic_config':
|
||||||
transport_url => $default_transport_url,
|
transport_url => $default_transport_url,
|
||||||
rpc_response_timeout => $rpc_response_timeout,
|
rpc_response_timeout => $rpc_response_timeout,
|
||||||
|
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- Added a class to run the db online_data_migrations. This needs to happen
|
||||||
|
after a dbsync when you when you upgrade to Pike. More info at
|
||||||
|
http://specs.openstack.org/openstack/ironic-specs/specs/approved/support-rolling-upgrade.html
|
64
spec/classes/ironic_db_online_data_migrations_spec.rb
Normal file
64
spec/classes/ironic_db_online_data_migrations_spec.rb
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe 'ironic::db::online_data_migrations' do
|
||||||
|
|
||||||
|
shared_examples_for 'ironic-db-online-data-migrations' do
|
||||||
|
|
||||||
|
it 'runs ironic-db-sync' do
|
||||||
|
is_expected.to contain_exec('ironic-db-online-data-migrations').with(
|
||||||
|
:command => 'ironic-dbsync --config-file /etc/ironic/ironic.conf online_data_migrations',
|
||||||
|
:path => '/usr/bin',
|
||||||
|
:user => 'ironic',
|
||||||
|
:refreshonly => 'true',
|
||||||
|
:try_sleep => 5,
|
||||||
|
:tries => 10,
|
||||||
|
:logoutput => 'on_failure',
|
||||||
|
:subscribe => ['Anchor[ironic::install::end]',
|
||||||
|
'Anchor[ironic::config::end]',
|
||||||
|
'Anchor[ironic::dbsync::end]',
|
||||||
|
'Anchor[ironic::db_online_data_migrations::begin]'],
|
||||||
|
:notify => 'Anchor[ironic::db_online_data_migrations::end]',
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "overriding extra_params" do
|
||||||
|
let :params do
|
||||||
|
{
|
||||||
|
:extra_params => '--config-file /etc/ironic/ironic_01.conf',
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
it {
|
||||||
|
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',
|
||||||
|
:path => '/usr/bin',
|
||||||
|
:user => 'ironic',
|
||||||
|
:refreshonly => 'true',
|
||||||
|
:try_sleep => 5,
|
||||||
|
:tries => 10,
|
||||||
|
:logoutput => 'on_failure',
|
||||||
|
:subscribe => ['Anchor[ironic::install::end]',
|
||||||
|
'Anchor[ironic::config::end]',
|
||||||
|
'Anchor[ironic::dbsync::end]',
|
||||||
|
'Anchor[ironic::db_online_data_migrations::begin]'],
|
||||||
|
:notify => 'Anchor[ironic::db_online_data_migrations::end]',
|
||||||
|
)
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
on_supported_os({
|
||||||
|
:supported_os => OSDefaults.get_supported_os
|
||||||
|
}).each do |os,facts|
|
||||||
|
context "on #{os}" do
|
||||||
|
let (:facts) do
|
||||||
|
facts.merge!(OSDefaults.get_facts())
|
||||||
|
end
|
||||||
|
|
||||||
|
it_configures 'ironic-db-online-data-migrations'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
Reference in New Issue
Block a user