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 8D2FA1FF185 for ; Mon, 21 Jul 2025 18:44:42 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 7546E164C7; Mon, 21 Jul 2025 18:45:40 +0200 (CEST) From: Christian Ebner To: pbs-devel@lists.proxmox.com Date: Mon, 21 Jul 2025 18:45:05 +0200 Message-ID: <20250721164507.1045869-48-c.ebner@proxmox.com> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250721164507.1045869-1-c.ebner@proxmox.com> References: <20250721164507.1045869-1-c.ebner@proxmox.com> MIME-Version: 1.0 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1753116314890 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 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 v10 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 --- changes since version 9: - 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 98ef28a31..019e29c39 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; @@ -345,19 +345,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