[pve-devel] [PATCH pve-manager 1/4] Set $running to 0 if undef.
    Wolfgang Link 
    w.link at proxmox.com
       
    Fri Jun  2 11:21:45 CEST 2017
    
    
  
check_running returns if the guest is not running undef.
In the logfunc we get a undefined warning. To avoid this we can set it to 0.
---
 PVE/Replication.pm | 3 +++
 1 file changed, 3 insertions(+)
diff --git a/PVE/Replication.pm b/PVE/Replication.pm
index ae3b771d..ae486e16 100644
--- a/PVE/Replication.pm
+++ b/PVE/Replication.pm
@@ -307,6 +307,9 @@ sub replicate {
 
     my $sorted_volids = [ sort keys %$volumes ];
 
+    # to avoid undef warnings from logfunc
+    $running = 0 if !defined($running);
+
     $logfunc->($start_time, "$jobid: guest => $vmid, type => $vmtype, running => $running");
     $logfunc->($start_time, "$jobid: volumes => " . join(',', @$sorted_volids));
 
-- 
2.11.0
    
    
More information about the pve-devel
mailing list