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 51D8A1FF0AF for ; Fri, 06 Nov 2026 18:23:19 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 327C8216C8; Fri, 06 Nov 2026 18:23:06 +0100 (CET) From: Christian Ebner To: pbs-devel@lists.proxmox.com Subject: [PATCH proxmox v2 10/43] pbs-api-types: add max/default retention timespan property to datastore Date: Fri, 6 Nov 2026 18:22:02 +0100 Message-ID: <20261106172235.890542-11-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: 1793985774316 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.478 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: HOXTNMHLMGMGVS5PENTDHTNTVVUE3LKU X-Message-ID-Hash: HOXTNMHLMGMGVS5PENTDHTNTVVUE3LKU 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: Intended to allow administrators to configure a maximum retention timespan which can be set on snapshots for given datastore, as otherwise users might be able to prevent snapshots from ever being cleaned up. Default is no limit, which also blocks setting any retention timestamps. The default retention timespan on the other hand allows to set a fallback retention for all snapshots not requesting a specific retention. It must however be contained within the max retention limits. Signed-off-by: Christian Ebner --- pbs-api-types/src/datastore.rs | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/pbs-api-types/src/datastore.rs b/pbs-api-types/src/datastore.rs index 91f2ba35..7307d971 100644 --- a/pbs-api-types/src/datastore.rs +++ b/pbs-api-types/src/datastore.rs @@ -25,8 +25,8 @@ use crate::{ Authid, BACKUP_ID_RE, BACKUP_NS_RE, BACKUP_TIME_RE, BACKUP_TYPE_RE, CryptMode, DATASTORE_NOTIFY_STRING_SCHEMA, Fingerprint, GC_SCHEDULE_SCHEMA, GROUP_OR_SNAPSHOT_PATH_REGEX_STR, GroupFilter, MaintenanceMode, MaintenanceType, - PROXMOX_SAFE_ID_FORMAT, PROXMOX_SAFE_ID_REGEX_STR, PRUNE_SCHEDULE_SCHEMA, SHA256_HEX_REGEX, - SINGLE_LINE_COMMENT_SCHEMA, SNAPSHOT_PATH_REGEX_STR, UPID, Userid, + PROXMOX_SAFE_ID_FORMAT, PROXMOX_SAFE_ID_REGEX_STR, PRUNE_SCHEDULE_SCHEMA, RetentionTimespan, + SHA256_HEX_REGEX, SINGLE_LINE_COMMENT_SCHEMA, SNAPSHOT_PATH_REGEX_STR, UPID, Userid, VERIFY_JOB_READ_THREADS_SCHEMA, VERIFY_JOB_VERIFY_THREADS_SCHEMA, }; @@ -530,6 +530,14 @@ pub const MAX_SNAPSHOT_TIME_SKEW_SCHEMA: Schema = optional: true, schema: MAX_SNAPSHOT_TIME_SKEW_SCHEMA, }, + "max-retention-timespan": { + type: RetentionTimespan, + optional: true, + }, + "default-retention-timespan": { + type: RetentionTimespan, + optional: true, + }, } )] #[derive(Serialize, Deserialize, Updater, Clone, PartialEq)] @@ -602,6 +610,14 @@ pub struct DataStoreConfig { /// Maximum allowed time skew between new snapshot's timestamp and server system time. #[serde(skip_serializing_if = "Option::is_none")] pub max_snapshot_time_skew: Option, + + /// Maximum retention timespan which can be set on this datastore + #[serde(skip_serializing_if = "Option::is_none")] + pub max_retention_timespan: Option, + + /// Default retention timespan used by this datastore + #[serde(skip_serializing_if = "Option::is_none")] + pub default_retention_timespan: Option, } #[api] @@ -645,6 +661,8 @@ impl DataStoreConfig { notification_thresholds: None, counter_reset_schedule: None, max_snapshot_time_skew: None, + max_retention_timespan: None, + default_retention_timespan: None, } } -- 2.47.3