[pve-devel] [PATCH pve-manager v3 1/3] fix #3903: jobs: add remove vmid from jobs helper

Fabian Ebner f.ebner at proxmox.com
Mon Mar 14 11:18:49 CET 2022


Am 14.03.22 um 11:00 schrieb Fabian Ebner:
> Am 14.03.22 um 10:26 schrieb Hannes Laimer:
>> Signed-off-by: Hannes Laimer <h.laimer at proxmox.com>
>> @@ -274,6 +274,25 @@ sub synchronize_job_states_with_config {
>>      die $@ if $@;
>>  }
>>  
>> +sub remove_vmid_from_jobs {
>> +    my ($vmid) = @_;
>> +
>> +    cfs_lock_file('jobs.cfg', undef, sub {
>> +	my $jobs_data = cfs_read_file('jobs.cfg');
>> +	for my $id (keys %{$jobs_data->{ids}}) {
>> +	    my $job = $jobs_data->{ids}->{$id};
>> +	    my $type = $job->{type};
>> +	    my $plugin = PVE::Jobs::Plugin->lookup($type);
>> +	    $jobs_data->{ids}->{$id} = $plugin->remove_vmid_from_job($job, $vmid);
>> +	    if (!defined($jobs_data->{ids}->{$id})) {
>> +		delete $jobs_data->{ids}->{$id};
> 
> If it's not defined, delete shouldn't be necessary anymore.

Well, assuming the writer handles that correctly. Actually, I don't mind
having the delete here after all.





More information about the pve-devel mailing list