[pbs-devel] [PATCH proxmox-backup v4 43/45] cli: add dedicated subcommand for datastore s3 refresh
Christian Ebner
c.ebner at proxmox.com
Mon Jun 23 11:41:04 CEST 2025
Allows to manually trigger an s3 refresh via proxmox-backup-manager
by calling the corresponding api endpoint handler.
Signed-off-by: Christian Ebner <c.ebner at proxmox.com>
---
src/bin/proxmox_backup_manager/datastore.rs | 30 +++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/src/bin/proxmox_backup_manager/datastore.rs b/src/bin/proxmox_backup_manager/datastore.rs
index 1922a55a2..8f5deadbd 100644
--- a/src/bin/proxmox_backup_manager/datastore.rs
+++ b/src/bin/proxmox_backup_manager/datastore.rs
@@ -290,6 +290,30 @@ async fn uuid_mount(param: Value, _rpcenv: &mut dyn RpcEnvironment) -> Result<Va
Ok(Value::Null)
}
+#[api(
+ protected: true,
+ input: {
+ properties: {
+ store: {
+ schema: DATASTORE_SCHEMA,
+ },
+ },
+ },
+)]
+/// Refresh datastore contents from S3 to local cache store.
+async fn s3_refresh(mut param: Value, rpcenv: &mut dyn RpcEnvironment) -> Result<(), Error> {
+ param["node"] = "localhost".into();
+
+ let info = &api2::admin::datastore::API_METHOD_S3_REFRESH;
+ let result = match info.handler {
+ ApiHandler::Sync(handler) => (handler)(param, info, rpcenv)?,
+ _ => unreachable!(),
+ };
+
+ crate::wait_for_local_worker(result.as_str().unwrap()).await?;
+ Ok(())
+}
+
pub fn datastore_commands() -> CommandLineInterface {
let cmd_def = CliCommandMap::new()
.insert("list", CliCommand::new(&API_METHOD_LIST_DATASTORES))
@@ -302,6 +326,12 @@ pub fn datastore_commands() -> CommandLineInterface {
pbs_config::datastore::complete_removable_datastore_name,
),
)
+ .insert(
+ "s3-refresh",
+ CliCommand::new(&API_METHOD_S3_REFRESH)
+ .arg_param(&["store"])
+ .completion_cb("store", pbs_config::datastore::complete_datastore_name),
+ )
.insert(
"show",
CliCommand::new(&API_METHOD_SHOW_DATASTORE)
--
2.47.2
More information about the pbs-devel
mailing list