From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id 21E6D1FF09D for ; Mon, 02 Nov 2026 00:00:20 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 5D43C217AA; Sun, 01 Nov 2026 23:59:16 +0100 (CET) From: Thomas Lamprecht To: pve-devel@lists.proxmox.com Subject: [PATCH manager 10/19] vzdump: list guests as skipped if the job could not start Date: Sun, 1 Nov 2026 23:58:37 +0100 Message-ID: <20261101225849.884587-11-t.lamprecht@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261101225849.884587-1-t.lamprecht@proxmox.com> References: <20261101225849.884587-1-t.lamprecht@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1793573948410 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.393 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: ZSKDAV6CMOY6HWWZTYBSLZDOTQY5P4UK X-Message-ID-Hash: ZSKDAV6CMOY6HWWZTYBSLZDOTQY5P4UK X-MailFrom: t.lamprecht@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: If a job could not get the global lock, or its setup failed, for example because the job-init hook failed or the backup server was not reachable, none of its guests got backed up, but the notification did not list any of them. List them as skipped with the reason, so notifications, including those sent only on failure, show what is missing. Signed-off-by: Thomas Lamprecht --- PVE/API2/VZDump.pm | 3 ++- PVE/VZDump.pm | 48 +++++++++++++++++++++++++++++++++++++--------- 2 files changed, 41 insertions(+), 10 deletions(-) diff --git a/PVE/API2/VZDump.pm b/PVE/API2/VZDump.pm index 083b9ea35..73291189f 100644 --- a/PVE/API2/VZDump.pm +++ b/PVE/API2/VZDump.pm @@ -143,7 +143,8 @@ __PACKAGE__->register_method({ }; if (my $err = $@) { chomp($err); # otherwise reported as multiple problems - $vzdump->send_notification([], 0, $err); + my $tasklist = $vzdump->skip_all_guests($rpcenv, $user, 'job did not start'); + $vzdump->send_notification($tasklist, 0, $err); die "$err\n"; } diff --git a/PVE/VZDump.pm b/PVE/VZDump.pm index a86be4f09..b12281790 100644 --- a/PVE/VZDump.pm +++ b/PVE/VZDump.pm @@ -387,7 +387,10 @@ my sub format_backup_task_logs { for my $task (@$task_list) { my $vmid = $task->{vmid}; - if (!$task->{tmplog}) { + if ($task->{state} eq 'skipped') { + $task_logs .= "$vmid: skipped - $task->{msg}\n\n"; + next; + } elsif (!$task->{tmplog}) { $task_logs .= "$vmid: no log available\n\n"; next; } @@ -1400,18 +1403,11 @@ sub exec_backup_task { die $err if $err && $err =~ m/^interrupted by signal$/; } -sub exec_backup { +sub get_tasklist { my ($self, $rpcenv, $authuser) = @_; my $opts = $self->{opts}; - debugmsg('info', "starting new backup job: $self->{cmdline}", undef, 1); - - if (scalar(@{ $self->{skiplist} })) { - my $skip_string = join(', ', sort { $a <=> $b } @{ $self->{skiplist} }); - debugmsg('info', "skip external VMs: $skip_string"); - } - my $tasklist = []; my $vzdump_plugins = {}; foreach my $plugin (@{ $self->{plugins} }) { @@ -1438,6 +1434,40 @@ sub exec_backup { }; } + return $tasklist; +} + +my sub skip_task { + my ($task, $reason) = @_; + + $task->{state} = 'skipped'; + $task->{msg} = $reason; + debugmsg('err', "Backup of VM $task->{vmid} skipped - $reason"); +} + +sub skip_all_guests { + my ($self, $rpcenv, $authuser, $reason) = @_; + + my $tasklist = $self->get_tasklist($rpcenv, $authuser); + skip_task($_, $reason) for $tasklist->@*; + + return $tasklist; +} + +sub exec_backup { + my ($self, $rpcenv, $authuser) = @_; + + my $opts = $self->{opts}; + + debugmsg('info', "starting new backup job: $self->{cmdline}", undef, 1); + + if (scalar(@{ $self->{skiplist} })) { + my $skip_string = join(', ', sort { $a <=> $b } @{ $self->{skiplist} }); + debugmsg('info', "skip external VMs: $skip_string"); + } + + my $tasklist = $self->get_tasklist($rpcenv, $authuser); + # Use in-memory files for the outer hook logs to pass them to sendmail. my $job_start_log = ''; my $job_end_log = ''; -- 2.47.3