Merge "Add support for --task-log option of db archive"

This commit is contained in:
Zuul 2021-07-27 08:52:30 +00:00 committed by Gerrit Code Review
commit 516d9c1d93
3 changed files with 43 additions and 1 deletions

View File

@ -71,6 +71,10 @@
# (optional) Adds --all-cells to the archive command
# Defaults to false.
#
# [*task_log*]
# (optional) Adds --task-log to the archive command
# Defaults to false.
#
# [*age*]
# (optional) Adds a retention policy when purging the shadow tables
# Defaults to undef.
@ -89,6 +93,7 @@ class nova::cron::archive_deleted_rows (
$purge = false,
$maxdelay = 0,
$all_cells = false,
$task_log = false,
$age = undef,
) {
@ -116,6 +121,13 @@ class nova::cron::archive_deleted_rows (
$all_cells_real = ''
}
if $task_log {
$task_log_real = ' --task-log'
}
else {
$task_log_real = ''
}
if $maxdelay == 0 {
$sleep = ''
} else {
@ -131,7 +143,7 @@ class nova::cron::archive_deleted_rows (
$cron_cmd = 'nova-manage db archive_deleted_rows'
cron { 'nova-manage db archive_deleted_rows':
command => "${sleep}${cron_cmd}${purge_real} --max_rows ${max_rows}${age_real}${until_complete_real}${all_cells_real} \
command => "${sleep}${cron_cmd}${purge_real} --max_rows ${max_rows}${age_real}${until_complete_real}${all_cells_real}${task_log_real} \
>>${destination} 2>&1",
environment => 'PATH=/bin:/usr/bin:/usr/sbin SHELL=/bin/sh',
user => pick($user, $::nova::params::nova_user),

View File

@ -0,0 +1,7 @@
---
features:
- |
The new ``nova::cron::archive_deleted_rows::task_log`` parameter has been
added. This parameter enables the ``--task-log`` option of
the ``nova-manage archive_deleted_rows`` command so that task logs are also
processed by the command.

View File

@ -16,6 +16,7 @@ describe 'nova::cron::archive_deleted_rows' do
:all_cells => false,
:age => false,
:maxdelay => 0,
:task_log => false,
:destination => '/var/log/nova/nova-rowsflush.log' }
end
@ -79,6 +80,28 @@ describe 'nova::cron::archive_deleted_rows' do
end
end
context 'task_log is true' do
before :each do
params.merge!(
:task_log => true,
)
end
it 'configures a cron with task_log' do
is_expected.to contain_cron('nova-manage db archive_deleted_rows').with(
:command => "nova-manage db archive_deleted_rows --max_rows #{params[:max_rows]} --task-log >>#{params[:destination]} 2>&1",
:environment => 'PATH=/bin:/usr/bin:/usr/sbin SHELL=/bin/sh',
:user => params[:user],
:minute => params[:minute],
:hour => params[:hour],
:monthday => params[:monthday],
:month => params[:month],
:weekday => params[:weekday],
:require => 'Anchor[nova::dbsync::end]',
)
end
end
context 'purge is true' do
before :each do
params.merge!(