From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id 80D7A1FF0C0 for ; Wed, 18 Nov 2026 14:30:54 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 58EDD217FE; Wed, 18 Nov 2026 14:30:03 +0100 (CET) From: Thomas Lamprecht To: pve-devel@lists.proxmox.com Subject: [PATCH v2 manager 10/20] vzdump: list guests as skipped if the job could not start Date: Wed, 18 Nov 2026 14:18:34 +0100 Message-ID: <20261118132947.1093069-11-t.lamprecht@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261118132947.1093069-1-t.lamprecht@proxmox.com> References: <20261118132947.1093069-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: 1795008592637 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.173 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: 6THU3SL3SR2C2WKC4H2OVSTEYAZA552F X-Message-ID-Hash: 6THU3SL3SR2C2WKC4H2OVSTEYAZA552F 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 --- changes v1 -> v2: - list the skipped guests inside the eval that patch 8 added PVE/API2/VZDump.pm | 6 +++++- PVE/VZDump.pm | 48 +++++++++++++++++++++++++++++++++++++--------- 2 files changed, 44 insertions(+), 10 deletions(-) diff --git a/PVE/API2/VZDump.pm b/PVE/API2/VZDump.pm index 4e59432f2..97b1797f8 100644 --- a/PVE/API2/VZDump.pm +++ b/PVE/API2/VZDump.pm @@ -143,7 +143,11 @@ __PACKAGE__->register_method({ }; if (my $err = $@) { chomp($err); # otherwise reported as multiple problems - eval { $vzdump->send_notification([], 0, $err) }; + eval { + my $tasklist = + $vzdump->skip_all_guests($rpcenv, $user, 'job did not start'); + $vzdump->send_notification($tasklist, 0, $err); + }; PVE::VZDump::debugmsg('err', $@) if $@; die "$err\n"; } diff --git a/PVE/VZDump.pm b/PVE/VZDump.pm index 352c8f0ba..fd2a74ab9 100644 --- a/PVE/VZDump.pm +++ b/PVE/VZDump.pm @@ -392,7 +392,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; } @@ -1416,18 +1419,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} }) { @@ -1454,6 +1450,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