From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 1D17C830C9 for ; Thu, 2 Dec 2021 11:42:15 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 0C1DF183A3 for ; Thu, 2 Dec 2021 11:41:45 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id 81E2C1839A for ; Thu, 2 Dec 2021 11:41:44 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 5BCBC44D92 for ; Thu, 2 Dec 2021 11:41:44 +0100 (CET) From: Dominik Csapak To: pve-devel@lists.proxmox.com Date: Thu, 2 Dec 2021 11:41:43 +0100 Message-Id: <20211202104143.2565096-1-d.csapak@proxmox.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.180 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH manager] vzdump: add new 'next-run' field for vzdump job listing X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Dec 2021 10:42:15 -0000 and calculate it by getting the next event after 'now' since we currently have no way to get the last run time for jobs only running on different cluster nodes Signed-off-by: Dominik Csapak --- PVE/API2/Backup.pm | 11 +++++++++++ www/manager6/dc/Backup.js | 16 ++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/PVE/API2/Backup.pm b/PVE/API2/Backup.pm index b1ad6afc..9953a704 100644 --- a/PVE/API2/Backup.pm +++ b/PVE/API2/Backup.pm @@ -16,6 +16,7 @@ use PVE::Exception qw(raise_param_exc); use PVE::VZDump; use PVE::VZDump::Common; use PVE::Jobs; # for VZDump Jobs +use PVE::RS::CalendarEvent; use base qw(PVE::RESTHandler); @@ -117,6 +118,16 @@ __PACKAGE__->register_method({ foreach my $jobid (sort { $order->{$a} <=> $order->{$b} } keys %$jobs) { my $job = $jobs->{$jobid}; next if $job->{type} ne 'vzdump'; + + if (my $schedule = $job->{schedule}) { + # vzdump jobs are cluster wide, there maybe was no local run + # so simply calculate from now + my $last_run = time(); + my $calspec = PVE::RS::CalendarEvent->new($schedule); + my $next_run = $calspec->compute_next_event($last_run); + $job->{'next-run'} = $next_run if defined($next_run); + } + push @$res, $job; } diff --git a/www/manager6/dc/Backup.js b/www/manager6/dc/Backup.js index 6f2d39bb..409ba48f 100644 --- a/www/manager6/dc/Backup.js +++ b/www/manager6/dc/Backup.js @@ -765,6 +765,22 @@ Ext.define('PVE.dc.BackupView', { sorter: (a, b) => (a.data.comment || '').localeCompare(b.data.comment || ''), flex: 1, }, + { + text: gettext('Next Run'), + dataIndex: 'next-run', + width: 150, + renderer: function(value) { + if (!value) { + return '-'; + } + + let now = new Date(), next = new Date(value * 1000); + if (next < now) { + return gettext('pending'); + } + return Proxmox.Utils.render_timestamp(value); + }, + }, { header: gettext('Retention'), dataIndex: 'prune-backups', -- 2.30.2