all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH manager v3 2/3] fix #4053: don't run vzdump jobs when they change from disabled->enabled
Date: Mon, 13 Jun 2022 15:24:09 +0200	[thread overview]
Message-ID: <20220613132411.3736044-3-d.csapak@proxmox.com> (raw)
In-Reply-To: <20220613132411.3736044-1-d.csapak@proxmox.com>

by updating the timestamp in the job state when enabled is changing
from 0 -> 1. We do it this way too in PBS for example, and is the more
sensible behaviour.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Reviewed-by: Fabian Ebner <f.ebner@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 9043c71a..0041d4fb 100644
--- a/PVE/API2/Backup.pm
+++ b/PVE/API2/Backup.pm
@@ -454,6 +454,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,
 		'repeat-missed' => 1,
@@ -467,15 +469,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) {
+		$need_run_time_update = 1;
+	    }
+
 	    $job->{all} = 1 if (defined($job->{exclude}) && !defined($job->{pool}));
 
 	    if (defined($param->{vmid})) {
@@ -493,7 +501,7 @@ __PACKAGE__->register_method({
 
 	    PVE::VZDump::verify_vzdump_parameters($job, 1);
 
-	    if ($schedule_updated) {
+	    if ($need_run_time_update) {
 		PVE::Jobs::update_last_runtime($id, 'vzdump');
 	    }
 
-- 
2.30.2





  parent reply	other threads:[~2022-06-13 13:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-13 13:24 [pve-devel] [PATCH manager/docs v3] handle missed jobs better Dominik Csapak
2022-06-13 13:24 ` [pve-devel] [PATCH manager v3 1/3] fix #4026: add 'repeat-missed' option for jobs Dominik Csapak
2022-06-13 13:24 ` Dominik Csapak [this message]
2022-06-13 13:24 ` [pve-devel] [PATCH manager v3 3/3] ui: dc/Backup: add 'repeat-missed' checkbox Dominik Csapak
2022-06-13 13:24 ` [pve-devel] [PATCH docs v3 1/1] vzdump: add section about 'repeat-missed' Dominik Csapak
2022-06-17 15:34 ` [pve-devel] applied-series: [PATCH manager/docs v3] handle missed jobs better Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220613132411.3736044-3-d.csapak@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal