Adds --all-cells to the archive command
Adds --all-cells to the archive command based on an empty_table boolean flag. If true, it will run in archive command on all configured cells. Depends-On: https://review.opendev.org/697012 Change-Id: Iaa47181318eb8b9251d47fd381784791f4967a4e
This commit is contained in:
parent
715043f3e1
commit
bb08feae87
@ -67,6 +67,10 @@
|
||||
# all cron jobs at the same time on all hosts this job is configured.
|
||||
# Defaults to 0.
|
||||
#
|
||||
# [*all_cells*]
|
||||
# (optional) Adds --all-cells to the archive command
|
||||
# Defaults to false.
|
||||
#
|
||||
|
||||
class nova::cron::archive_deleted_rows (
|
||||
$minute = 1,
|
||||
@ -80,6 +84,7 @@ class nova::cron::archive_deleted_rows (
|
||||
$until_complete = false,
|
||||
$purge = false,
|
||||
$maxdelay = 0,
|
||||
$all_cells = false,
|
||||
) {
|
||||
|
||||
include ::nova::deps
|
||||
@ -99,6 +104,13 @@ class nova::cron::archive_deleted_rows (
|
||||
$purge_real = ''
|
||||
}
|
||||
|
||||
if $all_cells {
|
||||
$all_cells_real = '--all-cells'
|
||||
}
|
||||
else {
|
||||
$all_cells_real = ''
|
||||
}
|
||||
|
||||
if $maxdelay == 0 {
|
||||
$sleep = ''
|
||||
} else {
|
||||
@ -108,7 +120,8 @@ 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} ${until_complete_real} >>${destination} 2>&1",
|
||||
command => "${sleep}${cron_cmd} ${purge_real} --max_rows ${max_rows} ${until_complete_real} \
|
||||
${all_cells_real} >>${destination} 2>&1",
|
||||
environment => 'PATH=/bin:/usr/bin:/usr/sbin SHELL=/bin/sh',
|
||||
user => pick($user, $::nova::params::nova_user),
|
||||
minute => $minute,
|
||||
|
@ -0,0 +1,6 @@
|
||||
---
|
||||
features:
|
||||
- Adds --all-cells to the archive command
|
||||
based on an empty_table boolean flag.
|
||||
If true, it will run in archive command
|
||||
on all configured cells.
|
@ -13,12 +13,13 @@ describe 'nova::cron::archive_deleted_rows' do
|
||||
:max_rows => '100',
|
||||
:user => 'nova',
|
||||
:until_complete => false,
|
||||
:all_cells => false,
|
||||
:maxdelay => 0,
|
||||
:destination => '/var/log/nova/nova-rowsflush.log' }
|
||||
end
|
||||
|
||||
context 'until_complete is false' do
|
||||
it 'configures a cron without until_complete' do
|
||||
context 'until_complete and all_cells is false' do
|
||||
it 'configures a cron without until_complete and all_cells' 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]} >>#{params[:destination]} 2>&1",
|
||||
:environment => 'PATH=/bin:/usr/bin:/usr/sbin SHELL=/bin/sh',
|
||||
@ -55,6 +56,28 @@ describe 'nova::cron::archive_deleted_rows' do
|
||||
end
|
||||
end
|
||||
|
||||
context 'all_cells is true' do
|
||||
before :each do
|
||||
params.merge!(
|
||||
:all_cells => true,
|
||||
)
|
||||
end
|
||||
|
||||
it 'configures a cron with all_cells' 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]} --all-cells >>#{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!(
|
||||
|
Loading…
Reference in New Issue
Block a user