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 Newton. Change-Id: Ibb119c280b5b6d07db06a63dd9efcc2526355f5f Related-Bug: 1656791
This commit is contained in:
parent
dc2f3a3586
commit
50c1733e79
|
@ -65,6 +65,11 @@
|
|||
# (optional) Run nova-manage api_db sync on api nodes after installing the package.
|
||||
# Defaults to true
|
||||
#
|
||||
# [*db_online_data_migrations*]
|
||||
# (optional) Run nova-manage db online_data_migrations on api nodes after
|
||||
# installing the package - required on upgrade.
|
||||
# Defaults to false.
|
||||
#
|
||||
# [*neutron_metadata_proxy_shared_secret*]
|
||||
# (optional) Shared secret to validate proxies Neutron metadata requests
|
||||
# Defaults to undef
|
||||
|
@ -246,6 +251,7 @@ class nova::api(
|
|||
$metadata_workers = $::processorcount,
|
||||
$sync_db = true,
|
||||
$sync_db_api = true,
|
||||
$db_online_data_migrations = false,
|
||||
$neutron_metadata_proxy_shared_secret = undef,
|
||||
$default_floating_pool = 'nova',
|
||||
$pci_alias = undef,
|
||||
|
@ -454,6 +460,9 @@ as a standalone service, or httpd for being run by a httpd server")
|
|||
if $sync_db_api {
|
||||
include ::nova::db::sync_api
|
||||
}
|
||||
if $db_online_data_migrations {
|
||||
include ::nova::db::online_data_migrations
|
||||
}
|
||||
|
||||
# Remove auth configuration from api-paste.ini
|
||||
nova_paste_api_ini {
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
#
|
||||
# Class to execute nova api_db sync
|
||||
#
|
||||
# ==Parameters
|
||||
#
|
||||
# [*extra_params*]
|
||||
# (optional) String of extra command line parameters to append
|
||||
# to the nova-manage db sync command. These will be inserted in
|
||||
# the command line between 'nova-manage' and 'db sync'.
|
||||
# Defaults to undef
|
||||
#
|
||||
# [*db_sync_timeout*]
|
||||
# (optional) Timeout for the execution of the db_sync
|
||||
# Defaults to 300.
|
||||
#
|
||||
class nova::db::online_data_migrations(
|
||||
$extra_params = undef,
|
||||
$db_sync_timeout = 300,
|
||||
) {
|
||||
|
||||
include ::nova::deps
|
||||
include ::nova::params
|
||||
|
||||
exec { 'nova-db-online-data-migrations':
|
||||
command => "/usr/bin/nova-manage ${extra_params} db online_data_migrations",
|
||||
refreshonly => true,
|
||||
try_sleep => 5,
|
||||
tries => 10,
|
||||
timeout => $db_sync_timeout,
|
||||
logoutput => on_failure,
|
||||
subscribe => [
|
||||
Anchor['nova::install::end'],
|
||||
Anchor['nova::config::end'],
|
||||
Anchor['nova::dbsync_api::end'],
|
||||
Anchor['nova::db_online_data_migrations::begin']
|
||||
],
|
||||
notify => Anchor['nova::db_online_data_migrations::end'],
|
||||
}
|
||||
}
|
|
@ -107,4 +107,12 @@ class nova::deps {
|
|||
anchor { 'nova::cell_v2::end':
|
||||
notify => Anchor['nova::dbsync::begin']
|
||||
}
|
||||
|
||||
# Wedge online data migrations after db/api_sync and before service
|
||||
anchor { 'nova::db_online_data_migrations::begin':
|
||||
subscribe => Anchor['nova::dbsync_api::end']
|
||||
} ->
|
||||
anchor { 'nova::db_online_data_migrations::end':
|
||||
notify => Anchor['nova::service::begin']
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 Newton. More info at
|
||||
https://bugs.launchpad.net/tripleo/+bug/1656791.
|
|
@ -0,0 +1,89 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'nova::db::online_data_migrations' do
|
||||
|
||||
shared_examples_for 'nova-db-online-data-migrations' do
|
||||
|
||||
it 'runs nova-db-sync' do
|
||||
is_expected.to contain_exec('nova-db-online-data-migrations').with(
|
||||
:command => '/usr/bin/nova-manage db online_data_migrations',
|
||||
:refreshonly => 'true',
|
||||
:try_sleep => 5,
|
||||
:tries => 10,
|
||||
:timeout => 300,
|
||||
:logoutput => 'on_failure',
|
||||
:subscribe => ['Anchor[nova::install::end]',
|
||||
'Anchor[nova::config::end]',
|
||||
'Anchor[nova::dbsync_api::end]',
|
||||
'Anchor[nova::db_online_data_migrations::begin]'],
|
||||
:notify => 'Anchor[nova::db_online_data_migrations::end]',
|
||||
)
|
||||
end
|
||||
|
||||
describe "overriding extra_params" do
|
||||
let :params do
|
||||
{
|
||||
:extra_params => '--config-file /etc/nova/nova.conf',
|
||||
}
|
||||
end
|
||||
|
||||
it {
|
||||
is_expected.to contain_exec('nova-db-online-data-migrations').with(
|
||||
:command => '/usr/bin/nova-manage --config-file /etc/nova/nova.conf db online_data_migrations',
|
||||
:refreshonly => 'true',
|
||||
:try_sleep => 5,
|
||||
:tries => 10,
|
||||
:timeout => 300,
|
||||
:logoutput => 'on_failure',
|
||||
:subscribe => ['Anchor[nova::install::end]',
|
||||
'Anchor[nova::config::end]',
|
||||
'Anchor[nova::dbsync_api::end]',
|
||||
'Anchor[nova::db_online_data_migrations::begin]'],
|
||||
:notify => 'Anchor[nova::db_online_data_migrations::end]',
|
||||
)
|
||||
}
|
||||
end
|
||||
|
||||
describe "overriding db_sync_timeout" do
|
||||
let :params do
|
||||
{
|
||||
:db_sync_timeout => 750,
|
||||
}
|
||||
end
|
||||
|
||||
it {
|
||||
is_expected.to contain_exec('nova-db-online-data-migrations').with(
|
||||
:command => '/usr/bin/nova-manage db online_data_migrations',
|
||||
:refreshonly => 'true',
|
||||
:try_sleep => 5,
|
||||
:tries => 10,
|
||||
:timeout => 750,
|
||||
:logoutput => 'on_failure',
|
||||
:subscribe => ['Anchor[nova::install::end]',
|
||||
'Anchor[nova::config::end]',
|
||||
'Anchor[nova::dbsync_api::end]',
|
||||
'Anchor[nova::db_online_data_migrations::begin]'],
|
||||
:notify => 'Anchor[nova::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({
|
||||
:processorcount => 8,
|
||||
:concat_basedir => '/var/lib/puppet/concat'
|
||||
}))
|
||||
end
|
||||
|
||||
it_configures 'nova-db-online-data-migrations'
|
||||
end
|
||||
end
|
||||
|
||||
end
|
Loading…
Reference in New Issue