[pve-devel] [PATCH pve-guest-common 5/5] PVE::Replication::run_replication - add verbose parameter
Dietmar Maurer
dietmar at proxmox.com
Tue Jun 20 10:50:57 CEST 2017
used for regression tests
Signed-off-by: Dietmar Maurer <dietmar at proxmox.com>
---
PVE/Replication.pm | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/PVE/Replication.pm b/PVE/Replication.pm
index 64432eb..0db427d 100644
--- a/PVE/Replication.pm
+++ b/PVE/Replication.pm
@@ -301,7 +301,7 @@ sub replicate {
}
my $run_replication_nolock = sub {
- my ($guest_class, $jobcfg, $iteration, $start_time, $logfunc) = @_;
+ my ($guest_class, $jobcfg, $iteration, $start_time, $logfunc, $verbose) = @_;
my $jobid = $jobcfg->{id};
@@ -327,7 +327,13 @@ my $run_replication_nolock = sub {
my $ctime = get_log_time();
print $logfd "$ctime $jobid: $msg\n";
- $logfunc->("$ctime $jobid: $msg") if $logfunc;
+ if ($logfunc) {
+ if ($verbose) {
+ $logfunc->("$ctime $jobid: $msg");
+ } else {
+ $logfunc->($msg);
+ }
+ }
};
$logfunc_wrapper->("start replication job");
@@ -356,7 +362,7 @@ my $run_replication_nolock = sub {
};
sub run_replication {
- my ($guest_class, $jobcfg, $iteration, $start_time, $logfunc, $noerr) = @_;
+ my ($guest_class, $jobcfg, $iteration, $start_time, $logfunc, $noerr, $verbose) = @_;
my $volumes;
@@ -364,7 +370,7 @@ sub run_replication {
my $timeout = 2; # do not wait too long - we repeat periodically anyways
$volumes = PVE::GuestHelpers::guest_migration_lock(
$jobcfg->{guest}, $timeout, $run_replication_nolock,
- $guest_class, $jobcfg, $iteration, $start_time, $logfunc);
+ $guest_class, $jobcfg, $iteration, $start_time, $logfunc, $verbose);
};
if (my $err = $@) {
return undef if $noerr;
--
2.11.0
More information about the pve-devel
mailing list