From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 753F71FF16F for ; Tue, 22 Jul 2025 12:15:48 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 8263136392; Tue, 22 Jul 2025 12:16:59 +0200 (CEST) From: Christian Ebner To: pbs-devel@lists.proxmox.com Date: Tue, 22 Jul 2025 12:11:04 +0200 Message-ID: <20250722101106.526438-49-c.ebner@proxmox.com> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250722101106.526438-1-c.ebner@proxmox.com> References: <20250722101106.526438-1-c.ebner@proxmox.com> MIME-Version: 1.0 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1753179088886 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.044 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [datastore.rs] Subject: [pbs-devel] [PATCH proxmox-backup v11 44/46] datastore: run s3-refresh when reusing a datastore with s3 backend X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox Backup Server development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pbs-devel-bounces@lists.proxmox.com Sender: "pbs-devel" Instead of relying on the user to manually trigger the refresh after datastore creation, do it already automatically in the datastore creation task, thereby improving ergonomics. Signed-off-by: Christian Ebner Reviewed-by: Lukas Wagner Reviewed-by: Hannes Laimer --- changes since version 10: - no changes src/api2/config/datastore.rs | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/src/api2/config/datastore.rs b/src/api2/config/datastore.rs index aa5ad722a..969beb14d 100644 --- a/src/api2/config/datastore.rs +++ b/src/api2/config/datastore.rs @@ -16,7 +16,7 @@ use proxmox_uuid::Uuid; use pbs_api_types::{ Authid, DataStoreConfig, DataStoreConfigUpdater, DatastoreBackendConfig, DatastoreBackendType, - DatastoreNotify, DatastoreTuning, KeepOptions, MaintenanceMode, PruneJobConfig, + DatastoreNotify, DatastoreTuning, KeepOptions, MaintenanceMode, Operation, PruneJobConfig, PruneJobOptions, DATASTORE_SCHEMA, PRIV_DATASTORE_ALLOCATE, PRIV_DATASTORE_AUDIT, PRIV_DATASTORE_MODIFY, PRIV_SYS_MODIFY, PROXMOX_CONFIG_DIGEST_SCHEMA, UPID_SCHEMA, }; @@ -34,7 +34,7 @@ use crate::api2::config::tape_backup_job::{delete_tape_backup_job, list_tape_bac use crate::api2::config::verify::delete_verification_job; use pbs_config::CachedUserInfo; -use pbs_datastore::get_datastore_mount_status; +use pbs_datastore::{get_datastore_mount_status, DatastoreBackend}; use proxmox_rest_server::WorkerTask; use proxmox_s3_client::S3ObjectKey; @@ -336,19 +336,37 @@ pub fn create_datastore( ..config }; + let store_name = config.name.to_string(); WorkerTask::new_thread( "create-datastore", - Some(config.name.to_string()), + Some(store_name.clone()), auth_id.to_string(), to_stdout, move |_worker| { do_create_datastore(lock, section_config, config, reuse_datastore)?; if let Some(prune_job_config) = prune_job_config { - do_create_prune_job(prune_job_config) - } else { - Ok(()) + do_create_prune_job(prune_job_config)?; } + + if reuse_datastore { + let datastore = pbs_datastore::DataStore::lookup_datastore( + &store_name, + Some(Operation::Lookup), + ) + .context("failed to lookup datastore")?; + match datastore + .backend() + .context("failed to get datastore backend")? + { + DatastoreBackend::Filesystem => (), + DatastoreBackend::S3(_s3_client) => { + proxmox_async::runtime::block_on(datastore.s3_refresh()) + .context("S3 refresh failed")?; + } + } + } + Ok(()) }, ) } -- 2.47.2 _______________________________________________ pbs-devel mailing list pbs-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel