public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Jakob Klocker <j.klocker@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH pve-storage-plugin-examples v4 2/7] backup provider example: reset per-guest state in backup_init
Date: Fri, 20 Nov 2026 17:05:05 +0100	[thread overview]
Message-ID: <20261120160510.311796-3-j.klocker@proxmox.com> (raw)
In-Reply-To: <20261120160510.311796-1-j.klocker@proxmox.com>

With backup retries, backup_init() can be called again for the same
guest within one job. Reset the per-guest state, so a retry does not
inherit the 'failed' flag or the removed backing image of the failed
attempt.

Signed-off-by: Jakob Klocker <j.klocker@proxmox.com>
---
 .../src/PVE/BackupProvider/Plugin/DirectoryExample.pm         | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/backup-provider-directory/src/PVE/BackupProvider/Plugin/DirectoryExample.pm b/backup-provider-directory/src/PVE/BackupProvider/Plugin/DirectoryExample.pm
index f61198b..2a53956 100644
--- a/backup-provider-directory/src/PVE/BackupProvider/Plugin/DirectoryExample.pm
+++ b/backup-provider-directory/src/PVE/BackupProvider/Plugin/DirectoryExample.pm
@@ -174,6 +174,10 @@ sub job_cleanup {
 sub backup_init {
     my ($self, $vmid, $vmtype, $backup_time) = @_;
 
+    # Start with fresh per-guest state. A failed attempt of the same job may have left
+    # state behind, like the 'failed' flag or 'previous' pointing to its removed directory.
+    $self->{$vmid} = {};
+
     my $archive_subdir = "${vmtype}-${backup_time}";
     my $archive = "${vmid}/${archive_subdir}";
 
-- 
2.47.3





  parent reply	other threads:[~2026-11-20 16:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20 16:05 [PATCH docs/guest-common/manager/storage/storage-plugin-examples v4 0/7] fix #6464: backup: add backup retry strategies Jakob Klocker
2026-11-20 16:05 ` [PATCH pve-storage-plugin-examples v4 1/7] backup provider example: run proxmox-perltidy Jakob Klocker
2026-11-20 16:05 ` Jakob Klocker [this message]
2026-11-20 16:05 ` [PATCH pve-storage v4 3/7] backup provider api: document repeated backup_init() calls on retries Jakob Klocker
2026-11-20 16:05 ` [PATCH pve-guest-common v4 4/7] vzdump: add error-behavior and max-retries options Jakob Klocker
2026-11-20 16:05 ` [PATCH pve-manager v4 5/7] fix #6464: vzdump: add retry strategies for failed guest backups Jakob Klocker
2026-11-20 16:05 ` [PATCH pve-manager v4 6/7] ui: backup: add error behavior and retry options Jakob Klocker
2026-11-20 16:05 ` [PATCH pve-docs v4 7/7] vzdump: document backup " Jakob Klocker

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=20261120160510.311796-3-j.klocker@proxmox.com \
    --to=j.klocker@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal