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 2308D1FF0AF for ; Fri, 06 Nov 2026 18:24:37 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 9D65421836; Fri, 06 Nov 2026 18:23:39 +0100 (CET) From: Christian Ebner To: pbs-devel@lists.proxmox.com Subject: [PATCH proxmox-backup v2 39/43] api: datastore: expose max/default retention timespans in status listing Date: Fri, 6 Nov 2026 18:22:31 +0100 Message-ID: <20261106172235.890542-40-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: 1793985781122 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.298 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) POISEN_SPAM_PILL 0.1 Meta: its spam POISEN_SPAM_PILL_1 0.1 random spam to be learned in bayes POISEN_SPAM_PILL_3 0.1 random spam to be learned in bayes 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: OV4CQR2UAFNO6ECPW23TXGUV7GDV333H X-Message-ID-Hash: OV4CQR2UAFNO6ECPW23TXGUV7GDV333H 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: Expose max-retention-timespan and default-retention-timespan in datastore status list items of /admin/datastore/{store}/status. Set the default retention timespan also on the datastore instance when parsed from the config and add the helper to access it. This will allow client to fetch this information in order to generate retention timestamps compatible with the datastore limits/defaults as well as backup/sync jobs to gather the default where needed. Signed-off-by: Christian Ebner --- pbs-datastore/src/datastore.rs | 8 ++++++++ src/api2/admin/datastore.rs | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/pbs-datastore/src/datastore.rs b/pbs-datastore/src/datastore.rs index 8fa6959f5..faf5a0410 100644 --- a/pbs-datastore/src/datastore.rs +++ b/pbs-datastore/src/datastore.rs @@ -214,6 +214,7 @@ pub struct DataStoreImpl { thresholds_exceeded_callback: Option, max_snapshot_time_skew: i64, max_retention_timespan: Option, + default_retention_timespan: Option, } impl DataStoreImpl { @@ -234,6 +235,7 @@ impl DataStoreImpl { thresholds_exceeded_callback: None, max_snapshot_time_skew: i64::try_from(DEFAULT_SNAPSHOT_TIME_SKEW_SECS).unwrap(), max_retention_timespan: None, + default_retention_timespan: None, }) } } @@ -817,6 +819,7 @@ impl DataStore { thresholds_exceeded_callback, max_snapshot_time_skew, max_retention_timespan: config.max_retention_timespan, + default_retention_timespan: config.default_retention_timespan, }) } @@ -862,6 +865,11 @@ impl DataStore { Ok(()) } + /// Return the configured default retention timespan + pub fn default_retention_timespan(&self) -> Option<&RetentionTimespan> { + self.inner.default_retention_timespan.as_ref() + } + /// Return the configured maximum retention timespan pub fn max_retention_timespan(&self) -> Option<&RetentionTimespan> { self.inner.max_retention_timespan.as_ref() diff --git a/src/api2/admin/datastore.rs b/src/api2/admin/datastore.rs index 563590430..186e43eb7 100644 --- a/src/api2/admin/datastore.rs +++ b/src/api2/admin/datastore.rs @@ -732,8 +732,8 @@ pub async fn status( counts, backend_type, s3_statistics, - default_retention_timespan: None, - max_retention_timespan: None, + max_retention_timespan: datastore.max_retention_timespan().cloned(), + default_retention_timespan: datastore.default_retention_timespan().cloned(), }) } -- 2.47.3