[pve-devel] [PATCH manager 2/3] fix #4053: enable 'skip-missed' behaviour also for change from disabled->enabled
Dominik Csapak
d.csapak at proxmox.com
Wed Jun 1 12:23:19 CEST 2022
so that if 'persistent' is configured to off, we don't immediately run
the job
Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
PVE/API2/Backup.pm | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/PVE/API2/Backup.pm b/PVE/API2/Backup.pm
index 7b00567a..251a892d 100644
--- a/PVE/API2/Backup.pm
+++ b/PVE/API2/Backup.pm
@@ -452,6 +452,8 @@ __PACKAGE__->register_method({
die "no such vzdump job\n" if !$job || $job->{type} ne 'vzdump';
}
+ my $old_enabled = $job->{enabled} // 1;
+
my $deletable = {
comment => 1,
'skip-missed' => 1,
@@ -465,15 +467,21 @@ __PACKAGE__->register_method({
delete $job->{$k};
}
- my $schedule_updated = 0;
+ my $need_run_time_update = 0;
if (defined($param->{schedule}) && $param->{schedule} ne $job->{schedule}) {
- $schedule_updated = 1;
+ $need_run_time_update = 1;
}
foreach my $k (keys %$param) {
$job->{$k} = $param->{$k};
}
+ my $new_enabled = $job->{enabled} // 1;
+
+ if ($new_enabled && !$old_enabled && $job->{'skip-missed'}) {
+ $need_run_time_update = 1;
+ }
+
$job->{all} = 1 if (defined($job->{exclude}) && !defined($job->{pool}));
if (defined($param->{vmid})) {
@@ -491,7 +499,7 @@ __PACKAGE__->register_method({
PVE::VZDump::verify_vzdump_parameters($job, 1);
- if ($schedule_updated) {
+ if ($need_run_time_update) {
PVE::Jobs::updated_job_schedule($id, 'vzdump');
}
--
2.30.2
More information about the pve-devel
mailing list