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 ADBA01FF0AF for ; Fri, 06 Nov 2026 18:24:40 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id CE17521729; Fri, 06 Nov 2026 18:23:39 +0100 (CET) From: Christian Ebner To: pbs-devel@lists.proxmox.com Subject: [PATCH proxmox-backup v2 40/43] backup/sync: fallback to datastore default-retention-timespan Date: Fri, 6 Nov 2026 18:22:32 +0100 Message-ID: <20261106172235.890542-41-c.ebner@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261106172235.890542-1-c.ebner@proxmox.com> References: <20261106172235.890542-1-c.ebner@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1793985781348 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.447 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: AU2BJNS6KI7M4LE4T4GHMM3K4O5OFHRB X-Message-ID-Hash: AU2BJNS6KI7M4LE4T4GHMM3K4O5OFHRB X-MailFrom: c.ebner@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 Backup Server development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: If a default retention timespan is configured on the datastore, use that as fallback if a backup or sync job does not specify any specific retention timestamp/timespan. Push syncs are covered by the same path as regular backups, pulls recalculate based on local target datastore config. s3-refresh and tape are not covered, since for these the pre-set retention settings are tried to be restored if compatible with datastore limits. Especially S3 backends would otherwise run into compatibility issues, once the S3 object locking and retention is enforced via the backend. Signed-off-by: Christian Ebner --- src/api2/backup/mod.rs | 13 ++++++++++--- src/server/pull.rs | 16 ++++++++++------ 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/api2/backup/mod.rs b/src/api2/backup/mod.rs index a057340ca..55ba25841 100644 --- a/src/api2/backup/mod.rs +++ b/src/api2/backup/mod.rs @@ -157,9 +157,16 @@ fn upgrade_to_backup_protocol( "backup" }; - if let Some(retain_until) = retain_until { - datastore.check_max_retention(retain_until)?; - } + let retain_until = match retain_until { + Some(retain_until) => { + datastore.check_max_retention(retain_until)?; + Some(retain_until) + } + None => datastore + .default_retention_timespan() + .map(|timespan| timespan.to_timestamp_from_systemtime()) + .transpose()?, + }; // lock backup group to only allow one backup per group at a time let (owner, group_guard) = datastore.create_locked_backup_group( diff --git a/src/server/pull.rs b/src/server/pull.rs index 44347c3ad..c2506ba2e 100644 --- a/src/server/pull.rs +++ b/src/server/pull.rs @@ -142,12 +142,16 @@ impl PullParameters { let group_filter = group_filter.unwrap_or_default(); - let retain_until = if let Some(retention) = retention_timespan { - let retain_until = retention.to_timestamp_from_systemtime()?; - (*store).check_max_retention(retain_until)?; - Some(retain_until) - } else { - None + let retain_until = match retention_timespan { + Some(retention) => { + let retain_until = retention.to_timestamp_from_systemtime()?; + (*store).check_max_retention(retain_until)?; + Some(retain_until) + } + None => (*store) + .default_retention_timespan() + .map(|timespan| timespan.to_timestamp_from_systemtime()) + .transpose()?, }; let target = PullTarget { store, ns, backend }; -- 2.47.3