From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id D79221FF16B for ; Tue, 15 Jul 2025 15:02:56 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 49D3B3CEB7; Tue, 15 Jul 2025 15:03:55 +0200 (CEST) From: Christian Ebner To: pbs-devel@lists.proxmox.com Date: Tue, 15 Jul 2025 14:53:30 +0200 Message-ID: <20250715125332.954494-53-c.ebner@proxmox.com> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250715125332.954494-1-c.ebner@proxmox.com> References: <20250715125332.954494-1-c.ebner@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.046 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_MSPIKE_H2 0.001 Average reputation (+2) SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pbs-devel] [PATCH proxmox-backup v8 43/45] 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 --- changes since version 7: - new in this version 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 2678a71fd..3e0a01a5b 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, }; @@ -33,7 +33,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; @@ -342,19 +342,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