Add support for --task-log option of db archive
Depends-on: https://review.opendev.org/c/openstack/nova/+/780395 Related-Bug: #1877189 Change-Id: I1e46d3912dce1d436776b5ac6ff63b734735f0a0
This commit is contained in:
@@ -71,6 +71,10 @@
|
|||||||
# (optional) Adds --all-cells to the archive command
|
# (optional) Adds --all-cells to the archive command
|
||||||
# Defaults to false.
|
# Defaults to false.
|
||||||
#
|
#
|
||||||
|
# [*task_log*]
|
||||||
|
# (optional) Adds --task-log to the archive command
|
||||||
|
# Defaults to false.
|
||||||
|
#
|
||||||
# [*age*]
|
# [*age*]
|
||||||
# (optional) Adds a retention policy when purging the shadow tables
|
# (optional) Adds a retention policy when purging the shadow tables
|
||||||
# Defaults to undef.
|
# Defaults to undef.
|
||||||
@@ -89,6 +93,7 @@ class nova::cron::archive_deleted_rows (
|
|||||||
$purge = false,
|
$purge = false,
|
||||||
$maxdelay = 0,
|
$maxdelay = 0,
|
||||||
$all_cells = false,
|
$all_cells = false,
|
||||||
|
$task_log = false,
|
||||||
$age = undef,
|
$age = undef,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
@@ -116,6 +121,13 @@ class nova::cron::archive_deleted_rows (
|
|||||||
$all_cells_real = ''
|
$all_cells_real = ''
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if $task_log {
|
||||||
|
$task_log_real = ' --task-log'
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$task_log_real = ''
|
||||||
|
}
|
||||||
|
|
||||||
if $maxdelay == 0 {
|
if $maxdelay == 0 {
|
||||||
$sleep = ''
|
$sleep = ''
|
||||||
} else {
|
} else {
|
||||||
@@ -131,7 +143,7 @@ class nova::cron::archive_deleted_rows (
|
|||||||
$cron_cmd = 'nova-manage db archive_deleted_rows'
|
$cron_cmd = 'nova-manage db archive_deleted_rows'
|
||||||
|
|
||||||
cron { '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",
|
>>${destination} 2>&1",
|
||||||
environment => 'PATH=/bin:/usr/bin:/usr/sbin SHELL=/bin/sh',
|
environment => 'PATH=/bin:/usr/bin:/usr/sbin SHELL=/bin/sh',
|
||||||
user => pick($user, $::nova::params::nova_user),
|
user => pick($user, $::nova::params::nova_user),
|
||||||
|
@@ -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.
|
@@ -16,6 +16,7 @@ describe 'nova::cron::archive_deleted_rows' do
|
|||||||
:all_cells => false,
|
:all_cells => false,
|
||||||
:age => false,
|
:age => false,
|
||||||
:maxdelay => 0,
|
:maxdelay => 0,
|
||||||
|
:task_log => false,
|
||||||
:destination => '/var/log/nova/nova-rowsflush.log' }
|
:destination => '/var/log/nova/nova-rowsflush.log' }
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -79,6 +80,28 @@ describe 'nova::cron::archive_deleted_rows' do
|
|||||||
end
|
end
|
||||||
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
|
context 'purge is true' do
|
||||||
before :each do
|
before :each do
|
||||||
params.merge!(
|
params.merge!(
|
||||||
|
Reference in New Issue
Block a user