marsadm: silence annoying warning at cron

This commit is contained in:
Thomas Schoebel-Theuer 2021-03-24 11:39:06 +01:00
parent 6692189b7c
commit 31491f8624
1 changed files with 5 additions and 4 deletions

View File

@ -2992,7 +2992,7 @@ sub check_sync_finished {
} }
sub check_primary { sub check_primary {
my ($cmd, $res, $no_designated, $no_fail) = @_; my ($cmd, $res, $no_designated, $no_fail, $no_warn) = @_;
my $fail = 0; my $fail = 0;
my $lnk = "$mars/resource-$res/actual-$host/is-primary"; my $lnk = "$mars/resource-$res/actual-$host/is-primary";
my $is_primary = get_link($lnk, 1); my $is_primary = get_link($lnk, 1);
@ -3000,13 +3000,13 @@ sub check_primary {
$is_primary = device_exists($res); $is_primary = device_exists($res);
} }
unless ($is_primary) { unless ($is_primary) {
lwarn "For operation '$cmd' I need to be primary\n"; lwarn "For operation '$cmd' I need to be primary\n" unless $no_warn;
$fail++; $fail++;
} }
if ($no_designated) { if ($no_designated) {
my $primary = _get_designated_primary($res); my $primary = _get_designated_primary($res);
unless ($primary eq $host) { unless ($primary eq $host) {
lwarn "For operation '$cmd', I also must be the designated primary\n"; lwarn "For operation '$cmd', I also must be the designated primary\n" unless $no_warn;
} }
} }
unless (defined($no_fail) && $no_fail) { unless (defined($no_fail) && $no_fail) {
@ -5365,7 +5365,8 @@ sub logrotate_res {
if ($force) { if ($force) {
lwarn "operation $cmd --force is DANGEROUS\n"; lwarn "operation $cmd --force is DANGEROUS\n";
} else { } else {
return if check_primary($cmd, $res, 0, 1); my $no_warn = ($cmd =~ /cron/);
return if check_primary($cmd, $res, 0, 1, $no_warn);
} }
my $log_glob = "$mars/resource-$res/log-*-$host"; my $log_glob = "$mars/resource-$res/log-*-$host";
lprint "get logfiles '$log_glob'\n"; lprint "get logfiles '$log_glob'\n";