]> git.proxmox.com Git - pve-guest-common.git/commitdiff
job_status: read only after acquiring the lock
authorFabian Ebner <f.ebner@proxmox.com>
Thu, 29 Oct 2020 13:31:25 +0000 (14:31 +0100)
committerFabian Grünbichler <f.gruenbichler@proxmox.com>
Fri, 6 Nov 2020 14:05:47 +0000 (15:05 +0100)
to get the current replication config and have the VM list
and state object as recent as possible.

Suggested-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
PVE/ReplicationState.pm

index 057cae6292196cc8732466a87190848dfda3d9ef..80d45d64c36bc1f2ed2e527601f070f1a10d2957 100644 (file)
@@ -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 $stateobj = read_state();
+       my $cfg = PVE::ReplicationConfig->new();
+       my $vms = PVE::Cluster::get_vmlist();
+
        foreach my $jobid (sort keys %{$cfg->{ids}}) {
            my $jobcfg = $cfg->{ids}->{$jobid};
            my $vmid = $jobcfg->{guest};