job_status: read only after acquiring the lock

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>
This commit is contained in:
Fabian Ebner 2020-10-29 14:31:25 +01:00 committed by Fabian Grünbichler
parent 60aeee5fb1
commit db9eb287d4

View 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};