[pve-devel] [PATCH guest-common 2/6] job_status: read only after acquiring the lock

Fabian Ebner f.ebner at proxmox.com
Mon Aug 10 14:35:53 CEST 2020


to get the current replication config and have the VM list
and state object as recent as possible.

Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---
 PVE/ReplicationState.pm | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/PVE/ReplicationState.pm b/PVE/ReplicationState.pm
index 057cae6..0c92778 100644
--- a/PVE/ReplicationState.pm
+++ b/PVE/ReplicationState.pm
@@ -234,13 +234,11 @@ sub job_status {
 
     my $jobs = {};
 
-    my $stateobj = read_state();
-
-    my $cfg = PVE::ReplicationConfig->new();
-
-    my $vms = PVE::Cluster::get_vmlist();
-
     my $func = sub {
+	my $cfg = PVE::ReplicationConfig->new();
+	my $stateobj = read_state();
+	my $vms = PVE::Cluster::get_vmlist();
+
 	foreach my $jobid (sort keys %{$cfg->{ids}}) {
 	    my $jobcfg = $cfg->{ids}->{$jobid};
 	    my $vmid = $jobcfg->{guest};
-- 
2.20.1






More information about the pve-devel mailing list